Skip to content

Built-ins

Built-in types and functions are ones implicitly defined in every module.

Types

See Types.

Functions

size

It calculates a size of a list or map. It is generic and you can apply it to any list and map types.

Its time complexity is O(n) for lists and O(1) for maps.

\(list [a]) number
\(map {k: v}) number

delete

It deletes a key from a map.

\(map {k: v}, key k) {k: v}

keys

It gets keys in a map.

\(map {k: v}) [k]

values

It gets values in a map.

\(map {k: v}) [v]

error

It creates an error with its source information.

\(x any) error

source

It extracts source information from an error.

\(e error) any

debug

It pretty-prints a given value.

Note that behavior of this function can change among system packages. You may not even see any messages with system packages whose systems do not have any consoles.

\(x any) none

go

It executes a function concurrently. Its return value is a future represented as a function that returns a result of the executed function.

\(\() a) \() a

race

It merges multiple lists into one by evaluating elements in the lists concurrently. Elements in each list are evaluated sequentially in order.

This function corresponds to the fan-in concurrency pattern in other languages where results of concurrent computation in multiple queues are merged into a queue.

\([[a]]) [a]