Skip to main content
Version: Next

prepend

Inserts an element at the start of a list.

prepend(xs:list, x:any) -> list

Description

The prepend function returns the list xs with x inserted at the front. The expression xs.prepend(y) is equivalent to [x, ...xs].

Examples

Prepend a number to a list

from {xs: [1, 2]}
xs = xs.prepend(3)
{xs: [3, 1, 2]}

See Also

append, concatenate