Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

MERGE two series (See related posts)

merge: func [
    "Merge A and B together, like a zipper, alternating elements"
    a [series!]
    b [series!]
    /only "Merge items as sub-blocks"
    /local res val
][
    res: make a length? a
    repeat i max length? a length? b [
        val: reduce [pick a i  pick b i]
        either only [append/only res val] [append res val]
    ]
    res
]

You need to create an account or log in to post comments to this site.


Click here to browse all 4875 code snippets

Related Posts