Daniel Lyons wrote: > On Aug 7, 2009, at 12:19 PM, Albert Cardona wrote: > >> Currently, one must resort to incantations like: >> >> (with-open [stream (java.io.BufferedReader. >> (java.io.FileReader. >> "/home/albert/test.xml"))] >> (doseq [line (line-seq stream)] >> (println line))) >> > > (use 'clojure.contrib.duck-streams) > > (doseq [line (read-lines "/home/albert/test.xml")] > (println line)) > > >> (Sure, one can write (vec (.split (slurp "/home/albert/test.xml") >> "\n")) >> but that >> again implies one knows the java API by heart.) >> > > (vec (read-lines "/home/albert/test.xml")) > > — > Daniel Lyons >
I am amused that the two answers I got (yours and Vagif's) tried to teach me about contrib duck-streams, a lib which I know and use. To restate my point: file I/O is incomplete in clojure core, lacking the consistency of other core blocks like regex. Albert -- Albert Cardona http://albert.rierol.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
