Skip to content

Latest commit

 

History

History
79 lines (38 loc) · 1.15 KB

File metadata and controls

79 lines (38 loc) · 1.15 KB

Home > @josh-brown/vector > VectorBuilder > fromIndexFunction

VectorBuilder.fromIndexFunction() method

Constructs a vector with entries given by _entry = f(i)_ where _f_ is valueFromIndex and i is the index of the element

Signature:

fromIndexFunction(dimension: number, valueFromIndex: VectorIndexFunction<S>): V;

Parameters

Parameter

Type

Description

dimension

number

The dimension of the vector to generate

valueFromIndex

VectorIndexFunction<S>

A function returning the entry for a given index

Returns:

V

The new vector

Example

vectorBuilder.fromIndexFunction(4, i => i + 3); // [ 3 4 5 6 ]