ValuesSet
A finite mathematical set of Nerdamer parser values.
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[]): ParserEntityMethodReads an element for parser indexing.
A RangeError if the index is outside the current set size.
Parameters
| Name | Type | Description |
|---|---|---|
indices | number[] | — |
Returns
__set__(indices: number[], value: ParserEntity): voidMethodReplaces the insertion-order element at an index while preserving uniqueness.
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.
A RangeError if the index is outside the current set size.
Parameters
| Name | Type | Description |
|---|---|---|
indices | number[] | — |
value | ParserEntity | — |
Returns
void
[iterator](): Iterator<ParserEntity>MethodReturns an iterator over the aggregate's current public element view.
Returns
Iterator<ParserEntity>
abs(): ValuesSetMethodNo description is available yet.
Returns
add(x: ParserEntity): ValuesSetMethodAdds an element if no semantically equal member is already present.
Parameters
| Name | Type | Description |
|---|---|---|
x | ParserEntity | — |
Returns
addMany(x: Iterable<ParserEntity>): ValuesSetMethodAdds every value in the iterable while preserving set uniqueness.
Parameters
| Name | Type | Description |
|---|---|---|
x | Iterable<ParserEntity> | — |
Returns
at(i: number): ParserEntity | undefinedMethodReturns a copy of the element at the requested insertion-order index.
Parameters
| Name | Type | Description |
|---|---|---|
i | number | — |
Returns
ParserEntity | undefined — A copy of the stored value, or undefined when the index is out of range.
buildFunction(argsArray?: string[]): (...args: number[]): numberMethodCompiles 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
| Name | Type | Description |
|---|---|---|
argsArray | string[] | Optional variable names in positional call order. |
Returns
(...args: number[]): number — A JavaScript-number function compiled from the scalar expression.
clear(): thisMethodRemoves every member from the set.
Returns
this
ValuesSet(values?: Iterable<ParserEntity, any, any>): ValuesSetConstructorNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
values | Iterable<ParserEntity, any, any> | — |
Returns
copy(): ValuesSetMethodReturns an independent set containing independent copies of all members.
Returns
count(): numberMethodReturns the current number of set members.
Returns
number
dataType: "SET" | "SOL"PropertyNo description is available yet.
delete(x: ParserEntity): booleanMethodRemoves the member semantically equal to x, if one is present.
Parameters
| Name | Type | Description |
|---|---|---|
x | ParserEntity | — |
Returns
boolean
diff(variable?: ExpressionInput, n?: number | Expression): thisMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
variable | ExpressionInput | — |
n | number | Expression | — |
Returns
this
Returns a new set containing members of this set that are absent from other.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
dimensions(): number[]MethodReturns the one-dimensional storage size used by parser indexing.
Returns
number[]
dimensionsMatch(x: ParserEntity): xMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
x | ParserEntity | — |
Returns
x
div(_x: NerdamerInput): ValuesSetMethodRejects binary division because finite sets do not define elementwise quotients.
core!UnsupportedOperationError Always.
Parameters
| Name | Type | Description |
|---|---|---|
_x | NerdamerInput | — |
Returns
each(callback: (e: ParserEntity, i?: string | number, j?: string | number): void | ParserEntity): thisMethodVisits 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
| Name | Type | Description |
|---|---|---|
callback | (e: ParserEntity, i?: string | number, j?: string | number): void | ParserEntity | — |
Returns
this
elements(): ParserEntity[]APIReturns 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
eq(other: ParserEntity): booleanMethodTests set equality by membership, independent of insertion order.
Parameters
| Name | Type | Description |
|---|---|---|
other | ParserEntity | — |
Returns
boolean
evaluate(values?: ParserValuesObject): ValuesSetMethodEvaluates every member and returns a new set, collapsing equal results.
Parameters
| Name | Type | Description |
|---|---|---|
values | ParserValuesObject | — |
Returns
expand(): ValuesSetMethodExpands every member and returns a new set, collapsing equal results.
Returns
factor(): thisMethodNo description is available yet.
Returns
this
forEach(callback: (e: ParserEntity, index: number): void): voidMethodVisits 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
| Name | Type | Description |
|---|---|---|
callback | (e: ParserEntity, index: number): void | — |
Returns
void
gt(other: ParserEntity): booleanMethodReturns the proper-superset relation for compatibility with parser comparison syntax. Prefer isProperSupersetOf in direct set-oriented code.
Parameters
| Name | Type | Description |
|---|---|---|
other | ParserEntity | — |
Returns
boolean
gte(other: ParserEntity): booleanMethodReturns the superset relation for compatibility with parser comparison syntax. Prefer isSupersetOf in direct set-oriented code.
Parameters
| Name | Type | Description |
|---|---|---|
other | ParserEntity | — |
Returns
boolean
has(x: ParserEntity): booleanMethodTests whether a semantically equal member is present.
Parameters
| Name | Type | Description |
|---|---|---|
x | ParserEntity | — |
Returns
boolean
integrate(variable?: ExpressionInput): thisMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
variable | ExpressionInput | — |
Returns
this
Returns a new set containing only members present in both sets.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
isDisjointFrom(other: ValuesSet): booleanMethodReturns true when this set has no member in common with other.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
boolean
isEnumerable: booleanPropertyNo description is available yet.
isProperSubsetOf(other: ValuesSet): booleanMethodReturns true when this set is a strict subset of other.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
boolean
isProperSupersetOf(other: ValuesSet): booleanMethodReturns true when this set is a strict superset of other.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
boolean
isSubsetOf(other: ValuesSet): booleanMethodReturns true when every member of this set is present in other.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
boolean
isSupersetOf(other: ValuesSet): booleanMethodReturns true when every member of other is present in this set.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
boolean
isValuesSet(obj: unknown): objMethodTests whether a value is a ValuesSet or a specialized ValuesSet subtype such as
SolutionSet.
Parameters
| Name | Type | Description |
|---|---|---|
obj | unknown | — |
Returns
obj
lt(other: ParserEntity): booleanMethodReturns the proper-subset relation for compatibility with parser comparison syntax. Prefer isProperSubsetOf in direct set-oriented code.
Parameters
| Name | Type | Description |
|---|---|---|
other | ParserEntity | — |
Returns
boolean
lte(other: ParserEntity): booleanMethodReturns the subset relation for compatibility with parser comparison syntax. Prefer isSubsetOf in direct set-oriented code.
Parameters
| Name | Type | Description |
|---|---|---|
other | ParserEntity | — |
Returns
boolean
minus(_x: NerdamerInput): ValuesSetMethodRejects binary subtraction because finite sets do not define elementwise subtraction.
core!UnsupportedOperationError Always.
Parameters
| Name | Type | Description |
|---|---|---|
_x | NerdamerInput | — |
Returns
numeric(precision?: ExpressionInput): thisMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
precision | ExpressionInput | — |
Returns
this
plus(_x: NerdamerInput): ValuesSetMethodBinary addition is not defined for finite sets. Use union for set union.
core!UnsupportedOperationError Always.
Parameters
| Name | Type | Description |
|---|---|---|
_x | NerdamerInput | — |
Returns
pow(_x: NerdamerInput): ValuesSetMethodRejects binary exponentiation because finite sets do not define elementwise powers.
core!UnsupportedOperationError Always.
Parameters
| Name | Type | Description |
|---|---|---|
_x | NerdamerInput | — |
Returns
precision: numberPropertyNo description is available yet.
simplify(): thisMethodNo description is available yet.
Returns
this
sort(compareFn?: (a: ParserEntity, b: ParserEntity): number): thisMethodSorts the deterministic iteration order without changing mathematical membership. A custom comparator receives copies so it cannot mutate stored members as a side effect.
Parameters
| Name | Type | Description |
|---|---|---|
compareFn | (a: ParserEntity, b: ParserEntity): number | — |
Returns
this
subst(value: ExpressionInput, withValue: ExpressionInput): thisMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
value | ExpressionInput | — |
withValue | ExpressionInput | — |
Returns
this
Returns a new set containing members present in exactly one of the two sets.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
Returns
text(): stringMethodNo description is available yet.
Returns
string
times(_x: NerdamerInput): ValuesSetMethodRejects binary multiplication because finite sets do not define elementwise products.
core!UnsupportedOperationError Always.
Parameters
| Name | Type | Description |
|---|---|---|
_x | NerdamerInput | — |
Returns
toArray(): ParserEntity[]MethodReturns a new array containing the aggregate's current public element view.
Returns
toString(): stringMethodNo description is available yet.
Returns
string
Returns a new set containing members present in either set.
Parameters
| Name | Type | Description |
|---|---|---|
other | ValuesSet | — |
