> What would be the best (idiomatic and efficiant) solution then?
> - wrap my file under a lazy sequence, call take & drop recursively
> with recur
> - just call readLine method directly when I need more lines and
> process them.
>

Hi,

Have a look at the functions:

line-seq
and
clojure.java.io/reader

I think you want something like:

(line-seq (reader "c:/test.txt"))

This returns you a lazy sequence of the lines in the file, which will only
read the file once, caching the lines that have been read in the seq.  The
sequence is immutable, though it will only read the lines from the
underlying file as required.

If you are interested in how this works, try (source line-seq) to see the
code.

-- 
Dave

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

Reply via email to