Is this a 1.1 or 1.2 fix? On Dec 14, 3:05 pm, Rich Hickey <richhic...@gmail.com> wrote: > On Mon, Dec 14, 2009 at 4:11 AM, Meikel Brandmeyer <m...@kotka.de> wrote: > > Hi, > > > Am 14.12.2009 um 01:07 schrieb Mark Triggs: > > >> (defn line-seq > >> "Returns the lines of text from rdr as a lazy sequence of strings. > >> rdr must implement java.io.BufferedReader." > >> [#^java.io.BufferedReader rdr] > >> (let [line (. rdr (readLine))] > >> (when line > >> (lazy-seq (cons line (line-seq rdr)))))) > > > Huh? Is there a reason, why it doesn't look like this: > > > (defn line-seq > > "Returns the lines of text from rdr as a lazy sequence of strings. > > rdr must implement java.io.BufferedReader." > > [#^java.io.BufferedReader rdr] > > (lazy-seq > > (when-let [line (.readLine rdr)] > > (cons line (line-seq rdr))))) > > > Is there some benefit treating a line-seq different to any other seq? > > The objective is to treat it like any (seq x) call, i.e. returning > nil if nothing there. line-seq et al are not sequence processing > functions like map/filter. They are seq obtainers. It's more like (seq > []) > > Rich
-- 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