Skip to main content

Expansion Operator

Symbol: ... Expansion operator ... works just like in JavaScript for construction and deconstruction of lists and maps.

Can work in two ways.
Together with value:

...a

or separated:

... a

Example:

= threeNumbers :: 1 2 3
= fiveNumbers :: ...threeNumbers 45
= (:: one ...restNumbers) fiveNumbers
= userFields :
name 'John'
age 13
= user :
id 1
gender 'm'
isAlive true
...userFields
= (: isAlive ...rest) user
console.log rest