Created
November 3, 2011 01:29
-
-
Save CampingScorpion/1335513 to your computer and use it in GitHub Desktop.
a variation of interleave that handles 0-infinite sequences
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
;; I dub thee, interleave++ | |
(defn interleave++ | |
"like interleave from core, but does something sensible with 0 or 1 collection" | |
([] | |
(lazy-seq [])) | |
([coll] | |
(lazy-seq coll)) | |
([coll1 coll2 & colls] | |
(apply (partial interleave coll1 coll2) colls))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment