A finite mathematical set of Nerdamer parser values.

remarks

Membership and uniqueness use each element's eq() method rather than JavaScript reference identity. Two members are considered equal only when both directional equality checks agree, which keeps mixed-type membership independent of insertion order. This treatment is conservative for symbolic values: if Nerdamer cannot establish that two elements are equal, they remain distinct. Values whose entity types cannot be compared are likewise treated as distinct members. In particular, set membership does not attempt theorem proving beyond the equality semantics of the stored values. ValuesSet owns its elements. Values passed to the constructor or add are copied, and elements, at, and indexed reads return copies. This prevents a caller from changing a stored mutable object behind the set and silently violating uniqueness. Mutation therefore goes through the set methods, which re-establish set uniqueness after every supported change. Iteration order is deterministic insertion order so text output and direct traversal are reproducible, but that order has no mathematical meaning. Equality and subset/superset comparisons are membership-based and ignore order. The arithmetic methods inherited by other structured entities are rejected here. Pairing two sets by insertion index would make arithmetic depend on a non-mathematical ordering. Use the explicit finite-set operations on this class instead.

Members

__get__(indices: number[]): ParserEntityMethod

Reads an element for parser indexing.

throws

A RangeError if the index is outside the current set size.

Parameters

NameTypeDescription
indicesnumber[]—

Returns

ParserEntity

__set__(indices: number[], value: ParserEntity): voidMethod

Replaces the insertion-order element at an index while preserving uniqueness.

remarks

If the replacement is already present elsewhere in the set, the indexed element is removed instead of creating a duplicate. Indexed mutation is provided for parser compatibility; the index is not part of the mathematical identity of a set.

throws

A RangeError if the index is outside the current set size.

Parameters

NameTypeDescription
indicesnumber[]—
valueParserEntity—

Returns

void

[iterator](): Iterator<ParserEntity>Method

Returns an iterator over the aggregate's current public element view.

Returns

Iterator<ParserEntity>

at(i: number): ParserEntity | undefinedMethod

Returns a copy of the element at the requested insertion-order index.

Parameters

NameTypeDescription
inumber—

Returns

ParserEntity | undefined — A copy of the stored value, or undefined when the index is out of range.

buildFunction(argsArray?: string[]): (...args: number[]): numberMethod

Compiles this value to a native JavaScript-number function when the parsed result is an Expression. Structured parser results expose this method so values returned by nerdamer(...) have one consistent TypeScript surface, but they cannot be compiled as scalar functions and throw core!UnexpectedDataType when called.

Parameters

NameTypeDescription
argsArraystring[]Optional variable names in positional call order.

Returns

(...args: number[]): number — A JavaScript-number function compiled from the scalar expression.

clear(): thisMethod

Removes every member from the set.

Returns

this

copy(): ValuesSetMethod

Returns an independent set containing independent copies of all members.

Returns

ValuesSet

count(): numberMethod

Returns the current number of set members.

Returns

number

dataType: "SET" | "SOL"Property

No description is available yet.

delete(x: ParserEntity): booleanMethod

Removes the member semantically equal to x, if one is present.

Parameters

NameTypeDescription
xParserEntity—

Returns

boolean

difference(other: ValuesSet): ValuesSetMethod

Returns a new set containing members of this set that are absent from other.

Parameters

NameTypeDescription
otherValuesSet—

Returns

ValuesSet

dimensions(): number[]Method

Returns the one-dimensional storage size used by parser indexing.

Returns

number[]

dimensionsMatch(x: ParserEntity): xMethod

No description is available yet.

Parameters

NameTypeDescription
xParserEntity—

Returns

x

div(_x: NerdamerInput): ValuesSetMethod

Rejects binary division because finite sets do not define elementwise quotients.

throws

core!UnsupportedOperationError Always.

Parameters

NameTypeDescription
_xNerdamerInput—

Returns

ValuesSet

each(callback: (e: ParserEntity, i?: string | number, j?: string | number): void | ParserEntity): thisMethod

Visits or maps the current members in insertion order. Duplicate mapped values collapse to their first occurrence. The callback receives a copy of each stored member, so mutating an input inside the callback cannot alter the set unless that value is returned. Returning void leaves the current member unchanged.

Parameters

NameTypeDescription
callback(e: ParserEntity, i?: string | number, j?: string | number): void | ParserEntity—

Returns

this

elements(): ParserEntity[]API

Returns a deep-copied snapshot of the set's current elements. Mutating the returned array or its members does not change this set. Use the set's mutation methods when the stored membership should change.

Returns

ParserEntity[]

eq(other: ParserEntity): booleanMethod

Tests set equality by membership, independent of insertion order.

Parameters

NameTypeDescription
otherParserEntity—

Returns

boolean

expand(): ValuesSetMethod

Expands every member and returns a new set, collapsing equal results.

Returns

ValuesSet

factor(): thisMethod

No description is available yet.

Returns

this

forEach(callback: (e: ParserEntity, index: number): void): voidMethod

Visits every current element without changing the aggregate. This is the observation-only counterpart to each. Concrete subclasses may narrow the callback element type when their membership method guarantees a more specific entity.

Parameters

NameTypeDescription
callback(e: ParserEntity, index: number): void—

Returns

void

gt(other: ParserEntity): booleanMethod

Returns the proper-superset relation for compatibility with parser comparison syntax. Prefer isProperSupersetOf in direct set-oriented code.

Parameters

NameTypeDescription
otherParserEntity—

Returns

boolean

gte(other: ParserEntity): booleanMethod

Returns the superset relation for compatibility with parser comparison syntax. Prefer isSupersetOf in direct set-oriented code.

Parameters

NameTypeDescription
otherParserEntity—

Returns

boolean

has(x: ParserEntity): booleanMethod

Tests whether a semantically equal member is present.

Parameters

NameTypeDescription
xParserEntity—

Returns

boolean

isDisjointFrom(other: ValuesSet): booleanMethod

Returns true when this set has no member in common with other.

Parameters

NameTypeDescription
otherValuesSet—

Returns

boolean

isEnumerable: booleanProperty

No description is available yet.

isProperSubsetOf(other: ValuesSet): booleanMethod

Returns true when this set is a strict subset of other.

Parameters

NameTypeDescription
otherValuesSet—

Returns

boolean

isProperSupersetOf(other: ValuesSet): booleanMethod

Returns true when this set is a strict superset of other.

Parameters

NameTypeDescription
otherValuesSet—

Returns

boolean

isSubsetOf(other: ValuesSet): booleanMethod

Returns true when every member of this set is present in other.

Parameters

NameTypeDescription
otherValuesSet—

Returns

boolean

isSupersetOf(other: ValuesSet): booleanMethod

Returns true when every member of other is present in this set.

Parameters

NameTypeDescription
otherValuesSet—

Returns

boolean

isValuesSet(obj: unknown): objMethod

Tests whether a value is a ValuesSet or a specialized ValuesSet subtype such as SolutionSet.

Parameters

NameTypeDescription
objunknown—

Returns

obj

lt(other: ParserEntity): booleanMethod

Returns the proper-subset relation for compatibility with parser comparison syntax. Prefer isProperSubsetOf in direct set-oriented code.

Parameters

NameTypeDescription
otherParserEntity—

Returns

boolean

lte(other: ParserEntity): booleanMethod

Returns the subset relation for compatibility with parser comparison syntax. Prefer isSubsetOf in direct set-oriented code.

Parameters

NameTypeDescription
otherParserEntity—

Returns

boolean

minus(_x: NerdamerInput): ValuesSetMethod

Rejects binary subtraction because finite sets do not define elementwise subtraction.

throws

core!UnsupportedOperationError Always.

Parameters

NameTypeDescription
_xNerdamerInput—

Returns

ValuesSet

pow(_x: NerdamerInput): ValuesSetMethod

Rejects binary exponentiation because finite sets do not define elementwise powers.

throws

core!UnsupportedOperationError Always.

Parameters

NameTypeDescription
_xNerdamerInput—

Returns

ValuesSet

precision: numberProperty

No description is available yet.

simplify(): thisMethod

No description is available yet.

Returns

this

sort(compareFn?: (a: ParserEntity, b: ParserEntity): number): thisMethod

Sorts the deterministic iteration order without changing mathematical membership. A custom comparator receives copies so it cannot mutate stored members as a side effect.

Parameters

NameTypeDescription
compareFn(a: ParserEntity, b: ParserEntity): number—

Returns

this

symmetricDifference(other: ValuesSet): ValuesSetMethod

Returns a new set containing members present in exactly one of the two sets.

Parameters

NameTypeDescription
otherValuesSet—

Returns

ValuesSet

text(): stringMethod

No description is available yet.

Returns

string

times(_x: NerdamerInput): ValuesSetMethod

Rejects binary multiplication because finite sets do not define elementwise products.

throws

core!UnsupportedOperationError Always.

Parameters

NameTypeDescription
_xNerdamerInput—

Returns

ValuesSet

toArray(): ParserEntity[]Method

Returns a new array containing the aggregate's current public element view.

Returns

ParserEntity[]

toString(): stringMethod

No description is available yet.

Returns

string