Dictionary
A key-value container where keys are strings (variable names) and values are any ParserEntity. Supports element-wise arithmetic operations.
The optional constructor Map is retained rather than copied. set and merge also retain value references, while copy copies every stored parser entity. Arrays returned by keys, values, and entries are new arrays, but their values still refer to the stored entities. Iteration and text output preserve Map insertion order. Replacing an existing key does not move it. each can replace values in place; returning nothing from its callback leaves a value unchanged. Use forEach for observation-only traversal. Evaluation and expansion return deep copies. Dictionaries support structural equality by key and value but define no greater-than or less-than ordering. Syntax: {x => 1, y => 2, z => x+3} Access: d[x] → 1, d[y] → 2 Assign: d[y]: 10
Members
__get__(indices: string | number[]): ParserEntityMethodReturns the element for the given string key. Used by the parser for bracket indexing: d[x] → d.getter('x')
Parameters
| Name | Type | Description |
|---|---|---|
indices | string | number[] | — |
Returns
__set__(indices: string | number[], value: ParserEntity): voidMethodSets the element for the given string key. Used by the parser for bracket assignment: d[x]: 5
Parameters
| Name | Type | Description |
|---|---|---|
indices | string | number[] | — |
value | ParserEntity | — |
Returns
void
[iterator](): IterableIterator<[string, ParserEntity]>MethodIterates over [key, value] pairs in insertion order.
Returns
IterableIterator<[string, ParserEntity]>
abs(): DictionaryMethodNo description is available yet.
Returns
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.
Dictionary(entries?: Map<string, ParserEntity>): DictionaryConstructorCreates a Dictionary, retaining the supplied Map when present.
Parameters
| Name | Type | Description |
|---|---|---|
entries | Map<string, ParserEntity> | — |
Returns
copy(): DictionaryMethodCopies the Dictionary, including every stored value.
Returns
count(): numberMethodNumber of entries.
Returns
number
dataType: "DIC"PropertyNo description is available yet.
delete(key: string): booleanMethodRemoves a key-value pair.
Parameters
| Name | Type | Description |
|---|---|---|
key | string | — |
Returns
boolean
diff(variable?: ExpressionInput, n?: number | Expression): DictionaryMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
variable | ExpressionInput | — |
n | number | Expression | — |
Returns
dimensions(): number[]MethodNo description is available yet.
Returns
number[]
dimensionsMatch(x: ParserEntity): xMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
x | ParserEntity | — |
Returns
x
div(x: NerdamerInput): DictionaryMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
x | NerdamerInput | — |
Returns
each(callback: (e: ParserEntity, i?: string | number, j?: string | number): void | ParserEntity): DictionaryMethodVisits or replaces entries in insertion order.
Returning a ParserEntity replaces the current value. Returning void leaves
that value unchanged, so callers can inspect a Dictionary without a dummy return.
The callback receives the value and string key.
Parameters
| Name | Type | Description |
|---|---|---|
callback | (e: ParserEntity, i?: string | number, j?: string | number): void | ParserEntity | — |
Returns
elements(): ParserEntity[]APISatisfies the StructuredEntity abstract property. Returns the values as an array for compatibility with element-wise operations.
Parameters
| Name | Type | Description |
|---|---|---|
values | ParserEntity[] | — |
Returns
entries(): [string, ParserEntity][]MethodReturns all entries in insertion order as a new pair array. Stored value objects are not copied.
Returns
[string, ParserEntity][]
eq(other: ParserEntity): booleanMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
other | ParserEntity | — |
Returns
boolean
evaluate(): DictionaryMethodEvaluates a copied Dictionary, leaving this one unchanged.
Returns
expand(): DictionaryMethodNo description is available yet.
Returns
factor(): DictionaryMethodNo description is available yet.
Returns
forEach(callback: (value: ParserEntity, key: string): void): voidMethodVisits stored value references without changing the Dictionary.
Parameters
| Name | Type | Description |
|---|---|---|
callback | (value: ParserEntity, key: string): void | — |
Returns
void
get(key: string): ParserEntity | undefinedMethodGets the stored value reference by key, or undefined when absent.
Parameters
| Name | Type | Description |
|---|---|---|
key | string | — |
Returns
ParserEntity | undefined
gt(_other: ParserEntity): booleanMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
_other | ParserEntity | — |
Returns
boolean
gte(other: ParserEntity): booleanMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
other | ParserEntity | — |
Returns
boolean
has(key: string): booleanMethodChecks if a key exists.
Parameters
| Name | Type | Description |
|---|---|---|
key | string | — |
Returns
boolean
integrate(variable?: ExpressionInput): DictionaryMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
variable | ExpressionInput | — |
Returns
isDictionary(obj: unknown): objMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
obj | unknown | — |
Returns
obj
isEnumerable: booleanPropertyNo description is available yet.
keys(): string[]MethodReturns all keys.
Returns
string[]
lt(_other: ParserEntity): booleanMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
_other | ParserEntity | — |
Returns
boolean
lte(other: ParserEntity): booleanMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
other | ParserEntity | — |
Returns
boolean
merge(other: Dictionary): DictionaryMethodMerges another Dictionary into this one. Existing keys are overwritten and incoming value references are retained.
Parameters
| Name | Type | Description |
|---|---|---|
other | Dictionary | — |
Returns
minus(x: NerdamerInput): DictionaryMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
x | NerdamerInput | — |
Returns
numeric(precision?: ExpressionInput): DictionaryMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
precision | ExpressionInput | — |
Returns
plus(x: NerdamerInput): DictionaryMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
x | NerdamerInput | — |
Returns
pow(x: NerdamerInput): DictionaryMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
x | NerdamerInput | — |
Returns
precision: numberPropertyNo description is available yet.
set(key: string, value: ParserEntity): DictionaryMethodSets a key-value pair by reference and returns this Dictionary.
Parameters
| Name | Type | Description |
|---|---|---|
key | string | — |
value | ParserEntity | — |
Returns
simplify(): DictionaryMethodNo description is available yet.
Returns
subst(value: ExpressionInput, withValue: ExpressionInput): DictionaryMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
value | ExpressionInput | — |
withValue | ExpressionInput | — |
Returns
text(): stringMethodNo description is available yet.
Returns
string
times(x: NerdamerInput): DictionaryMethodNo description is available yet.
Parameters
| Name | Type | Description |
|---|---|---|
x | NerdamerInput | — |
Returns
toString(): stringMethodNo description is available yet.
Returns
string
values(): ParserEntity[]MethodReturns stored value references in insertion order in a new array.
