atomo-0.4: prelude/list.atomo
@empty-list describe-error := "list is empty"
macro (a << b) `(~a = ~a push: ~b)
macro (a >> b) `(~b = ~b cons: ~a)
(l: -> List) pretty :=
{ brackets: (sep: (comma punctuate: (l map: @pretty)))
} doc
(t: -> Tuple) pretty :=
{ parens: (sep: (comma punctuate: (List (new: t) (map: @pretty))))
} doc
(l: List) each: (b: Block) :=
{ l map: b in-context
l
} call
[] includes?: List := False
(x: List) includes?: (y: List) :=
if: (x (take: y length) == y)
then: { True }
else: { x tail includes?: y }
[] join: List := []
[x] join: List := x
(x . xs) join: (d: List) :=
x .. d .. (xs join: d)