Data and Math
varray
Typed arrays of numbers, with integer and real number type codes.
Released v1.0.0 · 2026-09-28use "stdlib/array.ven"
A typed numeric array backed by a single list and checked against one of two type codes: whole numbers only, or any real number. Operations that change the array, such as appending or reversing, work in place. Values are stored as numbers, not packed bytes.
print array_to_list(array_new("d", [1.5, 2.5]))
Reference (12 functions)
API reference
array_new(typecode, values)
Builds a new VArray of typecode, seeded with the elements of values.
array_new("i", [3, 1, 4])array_to_list(arr)
Gives back arr's elements as a plain List.
array_to_list(array_new("i", [3, 1, 4]))array_append(arr, value)
Appends value to arr in place.
arr = array_new("i", [3, 1])
array_append(arr, 4)
array_to_list(arr)array_extend(arr, values)
Appends every element of values to arr in place.
arr = array_new("i", [3, 1])
array_extend(arr, [4, 5])
array_to_list(arr)array_count(arr, value)
Counts how many elements of arr equal value.
array_count(array_new("i", [3, 1, 4, 1]), 1)array_index(arr, value)
Gives back the index of the first element of arr equal to value.
array_index(array_new("i", [3, 1, 4]), 4)array_reverse(arr)
Reverses the order of arr's elements, in place.
arr = array_new("i", [3, 1, 4])
array_reverse(arr)
array_to_list(arr)