Hi, if you have a stream, you can basically do:
(defn stream-seq [stream] (take-while #(<= 0 %) (repeatedly #(.read stream)))) This will give a character at a time. From there you can build the lines and turn it into a seq of lines. Or can you can to the lower level and use lazy-seq directly. (defn stream-line-seq [stream] (lazy-seq (loop [line []] (let [ch (.read stream)] (cond (= \newline ch) (cons (apply str line) (stream-line-seq stream)) (<= 0 ch) (recur (conj line ch)) :else (when (< 0 (count line)) (cons (apply str line) nil))))))) Probably not the best implementation, but well... Of course lines is only an example. This can be used for any type of record. Beware of laziness in combination with resources like streams! (premature close etc.) Hope this helps. Sincerely Meikel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---