:
is the “prepend” operator:
x : xs
Returns a list which has x
as first element, followed by all elements in xs
. In other functional languages, this is usually called cons
, because it “cons”tructs a list recursively by repeated application from an empty list:
1 : 2 : 3 : 4 : []
is the list [1, 2, 3, 4]
.