Data and Math

varray

Typed arrays of numbers, with integer and real number type codes.

Released v1.0.0 · 2026-09-28
Import
use "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.

varray.ven
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_typecode(arr)

Gives back arr's typecode.

array_typecode(array_new("d", [1.5, 2.5]))

array_length(arr)

Gives back the number of elements in arr.

array_length(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_min(arr)

Gives back the smallest element of arr.

array_min(array_new("i", [3, 1, 4]))

array_max(arr)

Gives back the largest element of arr.

array_max(array_new("i", [3, 1, 4]))

array_sum(arr)

Gives back the sum of every element of arr.

array_sum(array_new("i", [3, 1, 4]))

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)

Get notified when varray changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.