Created
August 28, 2010 22:42
-
-
Save danlarkin/555658 to your computer and use it in GitHub Desktop.
This file contains 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 interleave-all [c1 c2] | |
(lazy-seq | |
(let [s1 (seq c1) s2 (seq c2)] | |
(when (or s1 s2) | |
(cons (first s1) (cons (first s2) | |
(interleave-all (rest s1) (rest s2)))))))) | |
=> (interleave [1 2 3] '[a b]) | |
(1 a 2 b) | |
=> (interleave-all [1 2 3] '[a b]) | |
(1 a 2 b 3 nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment