I'm trying to create a lazy-seq which is also closeable. What would be the cleanest way to do that in Clojure? Intended usage (but it's just one example, I can think of more usages for a closeable lazy sequance):
(with-open [lines (file-lines-seq file)]
(consume (map do-stuff-to-line lines)))
Which in this case would be equivalent to:
(with-open [reader io/reader file]
(consume (map do-stuff-to-line (line-seq file))))