Hi,
Looking at the
code<https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LazySeq.java>for
LazySeq.seq() I was wondering why a 'while' loop is used rather than an
'if' and a recursive call to ls.seq(), which would be cleaner code I guess?
Am I right to suspect this simply an optimization to avoid possible stack
overflow, or maybe for performance reasons, or is it some other reason?
final synchronized public ISeq seq(){
sval();
if(sv != null)
{
Object ls = sv;
sv = null;
while(ls instanceof LazySeq)
{
ls = ((LazySeq)ls).sval();
}
s = RT.seq(ls);
}
return s;
}
--
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.