deep-map ( ... obj quot: ( ... elt -- ... elt' ) -- ... newobj )
Factor handbook » The language » Collections » Sequence operations » Deep sequence combinators

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


Vocabulary
sequences.deep

Inputs
objan object
quota quotation with stack effect ( ... elt -- ... elt' )


Outputs
newobjthe mapped object


Word description
Execute a quotation on each nested element of an object and its children, in preorder. That is, the result of the execution of the quotation on the outer is used to map the inner elements.

See also
map

Definition


: deep-map
( ... obj quot: ( ... elt -- ... elt' ) -- ... newobj )
[ call ] keep over branch?
[ [ deep-map ] curry map ] [ drop ] if ; inline recursive