Skip to main content
Creating and working with arrays. Each row maps one concept from Lipi to the other languages; the word in a cell is the relation, explained in the language map overview. Each section below gives the Lipi construct first, then the construct in each language, with a note wherever behaviour differs. The language name links to the documentation the row was checked against.

Create an array

Creates an array of the given length. In Lipi: array.new, array.from, array.new_float, array.new_int.

Arrays of drawing objects

Creates an array of line IDs with size elements, each set to initial_value. In Lipi: array.new_line, array.new_label, array.new_box.

Read and write an element

Returns the element at index. In Lipi: array.get, array.set.

Number of elements

Returns the number of elements in the array. In Lipi: array.length.

Add or remove at the end

Appends value to the end of the array, growing it by one element. In Lipi: array.push, array.pop.

Add or remove at the start

Inserts value at the beginning of the array. In Lipi: array.unshift, array.shift.

Insert or remove at a position

Inserts value at index, moving the element that was there, and every element after it, up one index. In Lipi: array.insert, array.remove.

Empty or fill an array

Removes every element, leaving an empty array. In Lipi: array.clear, array.fill.

First and last element

Returns the first element of the array. In Lipi: array.first, array.last. Returns true when value is one of the array’s elements. In Lipi: array.includes, array.indexof, array.lastindexof, array.binary_search.

Copy, slice and join arrays

Returns a new array with the same elements. In Lipi: array.copy, array.slice, array.concat.

Sort and reverse

Sorts the array in place. In Lipi: array.sort, array.sort_indices, array.reverse.

Statistics of an array

Returns the sum of the array’s elements. In Lipi: array.sum, array.avg, array.min, array.max, array.median, array.stdev, array.variance.

Array to text

Joins the elements into one string, with separator between them. In Lipi: array.join.

Test all or any elements

Returns true when every element is true. In Lipi: array.every, array.some.