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