A finite mathematical set of Nerdamer parser values.

remarks

Membership and uniqueness use each element's

`eq()`

contract rather than JavaScript reference identity. Two members are considered equal only when both directional equality checks agree, which keeps heterogeneous membership independent of insertion order. This is intentionally 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 the uniqueness invariant 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 deliberately 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

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.

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

UnsupportedOperationError Always.

Parameters

NameTypeDescription
_xNerdamerInput

Returns

ValuesSet

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

Maps the current members in insertion order and replaces the set with the results. 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.

Parameters

NameTypeDescription
callback(e: ParserEntity, i?: string | number, j?: string | number): 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

evaluate(): ValuesSetMethod

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

Returns

ValuesSet

expand(): ValuesSetMethod

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

Returns

ValuesSet

factor(): thisMethod

No description is available yet.

Returns

this

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

UnsupportedOperationError Always.

Parameters

NameTypeDescription
_xNerdamerInput

Returns

ValuesSet

pow(_x: NerdamerInput): ValuesSetMethod

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

throws

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

symbolicAccessor: Expression[]Property

Public index expressions retained when bracket access cannot yet be resolved. This state belongs to a copied structured entity, never the stored source value.

symbolicTarget: ExpressionProperty

Original symbolic target used to render and later re-evaluate bracket access.

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

UnsupportedOperationError Always.

Parameters

NameTypeDescription
_xNerdamerInput

Returns

ValuesSet

toString(): stringMethod

No description is available yet.

Returns

string

withSymbolicAccessor(target: Expression, indices: Expression[]): ValuesSetMethod

Returns a copied structured entity carrying an unresolved bracket access. Existing accessor state is retained so chained symbolic access can be extended.

Parameters

NameTypeDescription
targetExpression
indicesExpression[]

Returns

ValuesSet