(defn read-records
"Read the data from the given reader as a list of strings, where
each string is made up of multiple lines, separated by // on it's own
line."
[reader]
(->> (line-seq reader)
(partition-by #{["//"]})
(filter (comp not #{["//"]}))
(map (partial apply str))))
-Walter
On Thursday, June 21, 2012 3:25:21 PM UTC-4, Joseph Guhlin wrote:
>
> I have a 2.5GB file, and will have other files, where the records are
> mutli-line (variable length) and are separated by // on a line by itself.
> What is the best way to read the record into a sequence of strings for
> parsing, and act on that record, and read the next record? It'd be great if
> it was lazy, as it's 2.5GB and there will be other / larger files in the
> future.
>
> I have it reading the file just fine if there is only one entry, it was
> nice and easy as well as fast and concise, so I'd love to be able to do the
> entire thing in clojure if possible.
>
> Thanks,
> --Joseph
>
--
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