An ordered, operable parser aggregate with heterogeneous ParserEntity elements.

remarks

Vector is not restricted to numeric linear-algebra values. General arithmetic is element-wise: scalar operands are broadcast across the Vector, while Vector operands are paired by position and must have the same length. Vector-to-Vector times remains an element-wise product rather than an alias for dot. A Matrix operand interprets this Vector as a row vector for the standard Vector * Matrix product; orientation is supplied by operand position rather than stored on the Vector. Structural methods such as append, insert, extend, reverse, and trim mutate this Vector. True linear-algebra operations (dot, cross, and norm) require Expression elements. dot requires equal lengths, while cross requires two three-element Vectors. These operations throw rather than assigning arithmetic meaning to arbitrary aggregate elements. Construction from a Collection copies its elements. Construction from an array normalizes inputs but retains existing parser entities; copy deep-copies every element. Comparisons are component-wise predicates, not a total ordering, and return false for a type or length mismatch.

Members

__get__(indices: number[]): ParserEntityMethod

Returns the element at the given zero-based index. Used by the parser for bracket indexing, e.g. [a, b, c][1] returns b.

throws

core!UnexpectedDataType If the index is out of bounds.

Parameters

NameTypeDescription
indicesnumber[]Zero-based parser indices after index-base adjustment.

Returns

ParserEntity — The stored parser entity.

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

Sets the element at the given index.

Parameters

NameTypeDescription
indicesnumber[]A single-element array [i]
valueParserEntityThe value to set

Returns

void

[iterator](): Iterator<ParserEntity>Method

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

Returns

Iterator<ParserEntity>

abs(): VectorMethod

No description is available yet.

Returns

Vector

add(x: ParserEntity): thisMethod

Appends an existing parser entity by reference and returns this Vector.

Parameters

NameTypeDescription
xParserEntity—

Returns

this

append(e: ParserEntity): thisMethod

Appends an existing parser entity by reference.

Parameters

NameTypeDescription
eParserEntityElement to append.

Returns

this

arrayMap(callback: (e: ParserEntity): unknown): unknown[]Method

No description is available yet.

Parameters

NameTypeDescription
callback(e: ParserEntity): unknown—

Returns

unknown[]

at(i: number): ParserEntity | undefinedMethod

Returns the stored entity at a zero-based index without copying it.

Parameters

NameTypeDescription
inumberZero-based index.

Returns

ParserEntity | undefined — The entity, 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 all elements from the vector.

Returns

this

copy(): VectorMethod

Copies the Vector and every contained entity.

Returns

Vector

count(): numberMethod

Gets the number of current elements in the Vector.

Returns

number — Current length.

cross(v: Vector): VectorMethod

Computes the three-dimensional cross product.

throws

core!DimensionError Unless both Vectors have exactly three elements.

throws

core!UnexpectedDataType If any required element is not an Expression.

Parameters

NameTypeDescription
vVector—

Returns

Vector

dataType: "VEC"Property

No description is available yet.

delete(x: ParserEntity): booleanMethod

No description is available yet.

Parameters

NameTypeDescription
xParserEntity—

Returns

boolean

dimensions(): number[]Method

No description is available yet.

Returns

number[]

dimensionsMatch(x: ParserEntity): xMethod

No description is available yet.

Parameters

NameTypeDescription
xParserEntity—

Returns

x

div(x: NerdamerInput): VectorMethod

Divides corresponding elements, or broadcasts a scalar divisor.

remarks

Vector-to-Vector division is element-wise and requires equal lengths. This is distinct from scalar division, which applies the same divisor to every element.

throws

core!DimensionError If a Vector divisor has a different length.

Parameters

NameTypeDescription
xNerdamerInput—

Returns

Vector

dot(v: Vector): ExpressionMethod

Computes the sum of pairwise products.

throws

core!DimensionError If the Vector lengths differ.

throws

core!UnexpectedDataType If a required element is not an Expression.

Parameters

NameTypeDescription
vVector—

Returns

Expression

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

Visits or replaces elements in ascending index order. Returning void leaves the current element unchanged.

Parameters

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

Returns

this

elements: ParserEntity[]Property

No description is available yet.

eq(V: ParserEntity): booleanMethod

No description is available yet.

Parameters

NameTypeDescription
VParserEntity—

Returns

boolean

expand(): VectorMethod

Expands a copied Vector, leaving this one unchanged.

Returns

Vector

extend(v: ParserEntity): VectorMethod

Appends another Vector's element references, mutating this Vector.

throws

core!UnexpectedDataType If v is not a Vector.

Parameters

NameTypeDescription
vParserEntityVector whose elements should be appended.

Returns

Vector — This Vector.

factor(): VectorMethod

No description is available yet.

Returns

Vector

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

getExpressionAt(n: number): ExpressionMethod

Returns an element after verifying that it is an Expression.

throws

core!UnexpectedDataType If the stored entity is not an Expression.

Parameters

NameTypeDescription
nnumberZero-based index.

Returns

Expression — The stored Expression reference.

gt(V: ParserEntity): booleanMethod

No description is available yet.

Parameters

NameTypeDescription
VParserEntity—

Returns

boolean

gte(V: ParserEntity): booleanMethod

No description is available yet.

Parameters

NameTypeDescription
VParserEntity—

Returns

boolean

indexOf(x: ParserEntity): numberMethod

Gets the index of the first element structurally equal to x.

Parameters

NameTypeDescription
xParserEntityValue to locate.

Returns

number — The zero-based index, or -1 when absent.

insert(i: number, x: ParserEntity): thisMethod

Inserts an entity by reference before the provided index.

Parameters

NameTypeDescription
inumberZero-based insertion index.
xParserEntityEntity to insert.

Returns

this — This mutated Vector.

isEnumerable: booleanProperty

No description is available yet.

isVector(obj: unknown): objMethod

No description is available yet.

Parameters

NameTypeDescription
objunknown—

Returns

obj

lt(V: ParserEntity): booleanMethod

No description is available yet.

Parameters

NameTypeDescription
VParserEntity—

Returns

boolean

lte(V: ParserEntity): booleanMethod

No description is available yet.

Parameters

NameTypeDescription
VParserEntity—

Returns

boolean

minus(x: NerdamerInput): VectorMethod

Subtracts corresponding elements, or broadcasts a scalar subtrahend.

throws

core!DimensionError If a Vector operand has a different length.

Parameters

NameTypeDescription
xNerdamerInput—

Returns

Vector

norm(): ExpressionMethod

Returns the Euclidean norm sqrt(sum(abs(element)^2)).

throws

core!UnexpectedDataType If any element is not an Expression.

Returns

Expression

plus(x: NerdamerInput): VectorMethod

Adds corresponding elements, or broadcasts a scalar addend.

throws

core!DimensionError If a Vector operand has a different length.

Parameters

NameTypeDescription
xNerdamerInput—

Returns

Vector

pop(index?: number): ParserEntity | undefinedMethod

Removes an element given an index. If none is provided it removes the last element. Indices are zero-based.

Parameters

NameTypeDescription
indexnumberOptional zero-based index.

Returns

ParserEntity | undefined — The removed entity, or undefined when no entity is present.

pow(x: NerdamerInput): VectorMethod

Raises corresponding elements to powers, or broadcasts a scalar exponent.

throws

core!DimensionError If a Vector exponent has a different length.

Parameters

NameTypeDescription
xNerdamerInput—

Returns

Vector

precision: numberProperty

No description is available yet.

prod(): ExpressionMethod

Multiplies all Expression elements in order.

throws

core!UnexpectedDataType If an element is not an Expression.

Returns

Expression — Their product, or one for an empty Vector.

remove(x: ParserEntity): VectorMethod

Removes the first element equal to x, rather than matching by reference.

Parameters

NameTypeDescription
xParserEntityValue to remove.

Returns

Vector — This Vector, whether or not a match was found.

reverse(): thisMethod

Reverses the Vector in place.

Returns

this — This Vector.

simplify(): VectorMethod

No description is available yet.

Returns

Vector

sum(): ExpressionMethod

Adds all Expression elements in order.

throws

core!UnexpectedDataType If an element is not an Expression.

Returns

Expression — Their sum, or zero for an empty Vector.

text(): stringMethod

No description is available yet.

Returns

string

times(x: NerdamerInput): VectorMethod

Multiplies corresponding Vector elements, broadcasts a scalar factor, or multiplies this Vector from the left of a Matrix.

remarks

Vector-to-Vector multiplication is the element-wise (Hadamard) product. Use dot when a scalar inner product is intended. For a Matrix operand, this Vector is interpreted as a row vector. Nonzero-width products reuse the existing Matrix-vector product through the transpose; a compatible zero-width Matrix has the empty Vector as its result because its transpose cannot be represented.

throws

core!DimensionError If Vector dimensions are incompatible.

throws

core!MathError If Matrix dimensions are incompatible.

Parameters

NameTypeDescription
xNerdamerInput—

Returns

Vector

toArray(): ParserEntity[]Method

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

Returns

ParserEntity[]

toPolynomial(vars: string[]): PolynomialMethod

Interprets ordered elements as ascending polynomial coefficients.

Parameters

NameTypeDescription
varsstring[]—

Returns

Polynomial

toString(): stringMethod

No description is available yet.

Returns

string

trim(): VectorMethod

Removes every element equal to zero.

Returns

Vector — This mutated Vector.