Created
January 30, 2011 16:19
-
-
Save RobinRamael/802982 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn interweave [list1 list2] | |
(loop [s1 (lazy-seq list1) s2 (lazy-seq list2) out (empty s1)] | |
(cond | |
(empty? s1) (concat out s2) | |
(empty? s2) (concat out s1) | |
:else (recur (rest s1) | |
(rest s2) | |
(concat out (seq (list (first s1) (first s2))))))) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment