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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---