Skip to content

Instantly share code, notes, and snippets.

@CampingScorpion
Created November 3, 2011 01:29
Show Gist options
  • Save CampingScorpion/1335513 to your computer and use it in GitHub Desktop.
Save CampingScorpion/1335513 to your computer and use it in GitHub Desktop.
a variation of interleave that handles 0-infinite sequences
;; 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