lmerge ( list1 list2 -- result ) (original) (raw)

Vocabulary
lists.lazy

Inputs

list1 a list
list2 a list

Outputs

result lazy list merging list1 and list2

Word description
Return the result of merging the two lists in a lazy manner.

Examples

USING: lists lists.lazy prettyprint ; { 1 2 3 } >list { 4 5 6 } >list lmerge list>array .
{ 1 4 2 5 3 6 }

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

Definition

USING: combinators kernel lists lists.lazy.private ;

IN: lists.lazy

: lmerge ( list1 list2 -- result )
{
{ [ over nil? ] [ nip ] }
{ [ dup nil? ] [ drop ] }
[ (lmerge) ]
} cond ;