@tempots/std
generateArray() function
Generates an array of values by applying a function to each index.
Signature:
generateArray: (length: number, f: (index: number) => A) => A[]
Parameters
Parameter |
Type |
Description |
---|---|---|
length |
number |
The length of the resulting array. |
f |
(index: number) => A |
The function to apply to each index. It takes the index as a parameter and returns the corresponding value. |
Returns: A[]
An array of values generated by applying the function to each index.