From 3ba49ed11139faab04b705ff86e0a378d599bf54 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Wed, 7 Nov 2018 22:52:49 -0500 Subject: [PATCH] Update core library. --- src/core/core.janet | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core/core.janet b/src/core/core.janet index d7a50bb8..1d27692e 100644 --- a/src/core/core.janet +++ b/src/core/core.janet @@ -793,6 +793,17 @@ value, one key will be ignored." (put freqs x (if n (+ 1 n) 1))) freqs) +(defn interleave + "Returns an array of the first elements of each col, + then the second, etc." + [& cols] + (def res @[]) + (def len (apply min 0 (mapa length cols))) + (loop [i :range [0 len]] + (loop [c :in col] + (array.push res (get c i)))) + res) + ### ### ### Pretty Printer