Sequence retention occurs here
... (let [parsed-lines (map parse-line (line-seq log-file-reader)) ...
The sequence of lines in the file is lazily generated and parsed, but the entire sequence is kept within the let . This sequence is implemented in doseq , but doseq not a problem; it does not support the sequence.
... (doseq [line parsed-lines] ; Do something ...
You donโt necessarily care about saving the sequence in let , because the let area is limited, but here your file is supposedly large and / or you stay within the dynamic let for or maybe return a closure containing it in the โdo somethingโ section .
Note that holding onto any given element of a sequence, including the first, does not contain a sequence. The term head-holding is a little incorrect if you think the chapter is the first element, as in the "chapter of the list" in Prolog. The problem is the link to the sequence.
A. Webb
source share