Deep sequence combinators
Factor handbook » The language » Collections » Sequence operations

Prev:Cartesian product operations
Next:Counted loops


The combinators in the sequences.deep vocabulary are variants of standard sequence combinators which traverse nested subsequences.
deep-each ( ... obj quot: ( ... elt -- ... ) -- ... )

deep-map ( ... obj quot: ( ... elt -- ... elt' ) -- ... newobj )

deep-filter ( ... obj quot: ( ... elt -- ... ? ) -- ... seq )

deep-find ( ... obj quot: ( ... elt -- ... ? ) -- ... elt )

deep-any? ( ... obj quot: ( ... elt -- ... ? ) -- ... ? )

deep-map! ( ... obj quot: ( ... elt -- ... elt' ) -- ... obj )


A utility word to collapse nested subsequences:
flatten ( obj -- seq )