prepend
Inserts an element at the start of a list.
prepend(xs:list, x:any) -> list
Description
Section titled “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
Section titled “Examples”Prepend a number to a list
Section titled “Prepend a number to a list”from {xs: [1, 2]}xs = xs.prepend(3)
{xs: [3, 1, 2]}