lcartesian-map ( list quot: ( elt1 elt2 -- newelt ) -- result ) (original) (raw)

Vocabulary
lists.lazy

Inputs

list a list of lists
quot a quotation with stack effect ( elt1 elt2 -- newelt )

Outputs

result the resulting list

Word description
Get the cartesian product of the lists in list and call quot call with each element from the cartesian product on the stack, the result of which is returned in the final list.

See also
leach, foldl, lmap-lazy, ltake, lfilter, lappend-lazy, lfrom, lfrom-by, lconcat, lcartesian-product, lcartesian-product*, lcartesian-map*, lmerge, lwhile, luntil

Definition

USING: kernel sequences ;

IN: lists.lazy

: lcartesian-map
( list quot: ( elt1 elt2 -- newelt ) -- result )
[ lcartesian-product* ] dip [ first2 ] prepose lmap-lazy ;