JanetDocsPlaygroundI'm feeling luckyGitHub sign in

interleave



    function
    boot.janet on line 1493, column 1

    (interleave & cols)

    Returns an array of the first elements of each col, then the 
    second, etc.


3 examplesSign in to add an example
Loading...
(interleave [:a :b :c] [1 2 3]) 
# => @[:a 1 :b 2 :c 3]

(interleave [:a :b :c] (range 3)) 
# => @[:a 0 :b 1 :c 2]

(interleave [:a :b :c] (range 2)) 
# => @[:a 0 :b 1]

(struct ;(interleave [:a :b :c] [1 2 3]))
# {:c 3 :a 1 :b 2}

(table ;(interleave [:a :b :c] [1 2 3]))
# @{:c 3 :a 1 :b 2}
leobmPlayground
# excess elements of the longer list are discarded
(interleave [1] 
            [2 4] 
            [3 6])
# -> @[1 2 3]
KrasjetPlayground
(interleave [:a :b :c] 
            [1 2 3] 
            ["x" "y" "z"])
# => @[:a 1 "x" :b 2 "y" :c 3 "z"]
sogaiuPlayground