Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created September 30, 2010 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amalloy/605420 to your computer and use it in GitHub Desktop.
Save amalloy/605420 to your computer and use it in GitHub Desktop.
(defn nested [seq1 & more-seqs]
"does an anonymous lazy 'for'-like nesting on a seq of seqs."
(letfn [(nestrec [prefix list [deep & deeper]]
(if deep
(mapcat #(nestrec (conj prefix %)
deep
deeper)
list)
(map #(conj prefix %) list)))]
(nestrec [] seq1 more-seqs)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment