Manipulating lists - Factor Documentation (original) (raw)

Manipulating lists
Factor handbook » The language » Collections » Lists

Prev: Constructing strict lists
Next: Combinators for lists

To get at the contents of a list:
uncons ( cons -- car cdr )
unswons ( cons -- cdr car )
lnth ( n list -- elt )
cadr ( list -- elt )
llength ( list -- n )

To get a new list from an old one:

lreverse ( list -- newlist )

lappend ( list1 list2 -- newlist )
lcut ( list index -- before after )