Array |
An array is a sequence of elements. Alchemy arrays are indexed from zero and dynamically expand.
An array is denoted by the "[" and "]" symbols, with elements separated by commas (',').
The following are examples of valid arrays:
[] [1, 2, 3, 4] ["Alpaca", "Buffalo", "Cheetah"] [1, [1,1], [1,2,1], [1,3,3,1]]
Alchemy includes a number of built-in functions that may be used to manipulate arrays. These functions include:
array.add - add an element to an array
array.contains - tests whether a value is contained in an array.
array.first - access the first element in an array
array.flatten - expands single array elements (of type array)into multiple elements.
array.get_at - access an element in an array by index
array.join - converts an array to a string, inserting a specified delimiter between elements.
array.last - returns the last element of an array.
array.new - return a new 1-dimensional array initialized by the supplied values.
array.pop - pop an element from the head of an array
array.range - retrieve an range of consecutive elements from an array
array.set_at - set the data stored in an element by index