The array library

Functions for the Array type.

Synopsis

array_from_list :: for_type T: (List(T)) -> Array(T)
array_get :: for_type t: (Array(t), 1) -> t
array_put :: for_type t: (Array(t), 1, t) -> Void
array_size :: for_type t: (Array(t)) -> 1
array_to_list :: for_type T: (Array(T)) -> List(T)
make_array :: for_type t: (1) -> Array(t)

Functions

array_from_list

:: for_type T: (List(T)) -> Array(T)

Creates an array from a list.

Say a = array_from_list(xs) then

    array_size(a) = list_size(xs) and
    array_get(a, i) = nth(i, xs)

array_get

:: for_type t: (Array(t), 1) -> t

Retrieves a previously stored item from an array.

It is an error if the index is out of bounds or no item was stored previously.

Primitive function

array_put

:: for_type t: (Array(t), 1, t) -> Void

Stores an item in the array at the asked position.

Primitive function

array_size

:: for_type t: (Array(t)) -> 1

The size of the array that was given at construction.

Primitive function

array_to_list

:: for_type T: (Array(T)) -> List(T)

Creates a list from an array.

Say xs = array_to_list(a) then

    list_size(xs) = array_size(a) and
    nth(i, xs) = array_get(a, i)

make_array

:: for_type t: (1) -> Array(t)

Constructs an array of the asked size.

Primitive function

Version v0.6.2, 2026-05-24T18:22:21.795602100+02:00[Europe/Amsterdam]