Revision: 55041
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 23, 2012 23:53 by ef
Initial Code
(defn lazy-input
"Returns a lazy sequence of characters from an input stream or Reader."
[input-stream]
(let [step (fn step []
(let [c (.read input-stream)]
(when-not (== c -1)
(cons (char c) (lazy-seq (step))))))]
(lazy-seq (step))))
Initial URL
Initial Description
Taken from here http://groups.google.com/group/clojure/msg/1590311bac972d15, useful if you can not (or do not want to) line-seq file (e.g. when whole file is one big line).
Initial Title
Lazy characters input
Initial Tags
Initial Language
Clojure