Re: Lazily extract lines from large file

2012-08-22 Thread Stephen Compall
On Aug 17, 2012 4:53 PM, "David Jacobs" wrote: > Okay that's great. Thanks, you guys. Was read-lines only holding onto > the head of the line seq because I bound it in the let statement? No; (partial nth values) holds on to values, and map holds on to the function you give it. Omitting needless

Re: Lazily extract lines from large file

2012-08-17 Thread Ben Smith-Mannschott
Interestingly, if I manually pull out a line from the file >>> with something like `(nth lines 200)`, the `multi-nth` call works for all >>> values <= 200. >>> >>> Any idea what's going on? >>> >>> PS This question is on SO if someone wants poi

Re: Lazily extract lines from large file

2012-08-17 Thread David Jacobs
for all >> values <= 200. >> >> Any idea what's going on? >> >> PS This question is on SO if someone wants points: >> http://stackoverflow.com/questions/11995807/lazily-extract-lines-from-large-file > > The lazyness of map is biting you. The result of

Re: Lazily extract lines from large file

2012-08-17 Thread Ben Smith-Mannschott
ll works for all > values <= 200. > > Any idea what's going on? > > PS This question is on SO if someone wants points: > http://stackoverflow.com/questions/11995807/lazily-extract-lines-from-large-file The lazyness of map is biting you. The result of read-lines wi

Re: Lazily extract lines from large file

2012-08-16 Thread Lars Nilsson
On Thu, Aug 16, 2012 at 5:47 PM, David Jacobs wrote: > I'm trying to grab 5 lines by their line numbers from a large (> 1GB) file > with Clojure. > > So far I've got: > > (defn multi-nth [values indices] > (map (partial nth values) indices)) > > (defn read-lines [file indices] > (with-open [rd

Lazily extract lines from large file

2012-08-16 Thread David Jacobs
an read the second line from the file. Interestingly, if I manually pull out a line from the file with something like `(nth lines 200)`, the `multi-nth` call works for all values <= 200. Any idea what's going on? PS This question is on SO if someone wants points: http://stackoverflow.co