Hi All,
I'll confused about the hold-onto-your-head business when building lazy seqs
using lazy-seq.
The "lazier" documentation on the web site doesn't really clear things up
for me, though I've read it a few times.
Under what circumstances must one use a "step" function, and under what
circumstances it it acceptable not to?
If this is covered in depth somewhere other than the "lazier" page please
feel free just to send a link.
As a point of discussion, does the following function have the potential to
cause memory problems?
Some notes: *kernel* and *options* are dynamic vars I want the lazy-seq to
close over. parse-simple-atom is a function for parsing each element
("atom," **unrelated to Clojure atoms**) of the coll. type is an arg that is
used in the parsing of each element of the coll.
(defn parse-expr-coll-to-lazy-seq [coll type]
(let [kernel *kernel*
options *options*]
(lazy-seq
(binding [*kernel* kernel
*options* options]
(when-let [s (seq coll)]
(cons (parse-simple-atom (first s) type)
(parse-expr-coll-to-lazy-seq (rest s) type)))))))
Thanks,
Garth
--
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