Similar to lazy-seq but binds the resulting seq to the supplied
binding-name, allowing for recursive expressions.
(defmacro rec-seq
"Similar to lazy-seq but binds the resulting seq to the supplied
binding-name, allowing for recursive expressions."
[binding-name & body]
`(let [s# (atom nil)]
(reset! s# (lazy-seq (let [~binding-name @s#] ~@body)))))
Comments top
No comments for rec-seq. Log in to add a comment.