array initialization function

float[]string[]bool[] [value, value, ...]
float[]string[]bool[] [value, value, ... ; value, value, ... ; ...]

value floatfloat[]stringstring[]boolbool[] Array element values. At least one element must be specified.

Returns an array containing all elements in the specified arrangement. The type of the array depends on the type of value. For example, a float[] array can be made from a mixture of float and float[] values.

1D array

An array can be initialized by concatenating primitive values separated by commas.

const a = ["B", "C", "D"]                  (3)[B,C,D]

Besides primitive values, arrays can also be used to create new arrays.

const b = ["A", a, "E"]                    (5)[A,B,C,D,E]

2D array

Primitive values and arrays can be arranged in several rows separated by semicolons.

const a = [-1 ; -2]                        (2x1)
                                              -1
                                              -2

const b = [0:2 ; 3, 3, 3]                  (2x3)
                                               0   1   2
                                               3   3   3

const c = [a, b ; b, a]                    (4x4)
                                              -1   0   1    2
                                              -2   3   3    3
                                               0   1   2   -1
                                               3   3   3   -2
The size of the returned array is limited. It can be configured in the Procedural Runtime preferences. The default is 100000.
Empty arrays can be created using floatArray, boolArray, and stringArray.

Related

Example

Fibonacci numbers

fibonacci(n) = case n <= 2 : [0:n-1]
               else        : fibonacci([0,1], n)

fibonacci(a, n) = case size(a) == n : a
                  else              : fibonacci([a, a[size(a)-2] + a[size(a)-1]], n)

Lot --> print(fibonacci(10))  // (10)[0,1,1,2,3,5,8,13,21,34]