Skip to content

Instantly share code, notes, and snippets.

@Licenser
Created March 17, 2010 17:04
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 Licenser/335459 to your computer and use it in GitHub Desktop.
Save Licenser/335459 to your computer and use it in GitHub Desktop.
(defn lazy-open-file-seq [rdr]
(let [seq-fn (fn seq-fn [rdr list]
(lazy-seq
(try
(if list
(cons (first list) (seq-fn rdr (rest list)))
(do
(.close rdr)
nil) )
(catch Exception e (.close rdr))
)))] (seq-fn rdr (line-seq rdr))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment