lcut ( list index -- before after )
Factor handbook » The language » Collections » Lists » Manipulating lists

Prev:lappend ( list1 list2 -- newlist )


Vocabulary
lists

Inputs
lista list
indexan integer


Outputs
beforea cons
aftera cons


Word description
Analogous to cut, this word cuts a list into two pieces at the given index.

Definition


: lcut ( list index -- before after )
[ nil ] dip [ [ unswons ] dip cons ] times lreverse swap ;