Skip to content

Instantly share code, notes, and snippets.

View jclaggett's full-sized avatar

Jonathan Claggett jclaggett

View GitHub Profile
(defmacro lazy
"Returns a lazy sequence of calls to (f). Arguments are evaluated once as needed.
(lazy f a b c d) --> (a, (f a b), (f (f a b) c), (f (f (f a b) c) d))"
([f x]
`(lazy-seq
(list ~x)) )
([f x form & more]
`(lazy-seq
(let [x# ~x]
(cons x#