Thanks Steve for the clear explanation.
Now I get it...
But a question on "... are evaluated and then immediately thrown
away".
I believe the evaluation is done in (or (first coll) true)).
My question is that extracting out "first coll" is same as evaluating
"first coll"?
For example (first '( (+ 1 2) (+ 3 4))) returns (+ 1 2) not the
evaluated
result, which is 3.
Wait... I just tried (first (list (+ 1 2) (+ 3 4))) and got 3!
So (list a b c) is different than '( a b c)? I thought they are
equivalent!

-sun




On Jan 25, 7:47 pm, "Stephen C. Gilardi" <squee...@mac.com> wrote:
> On Jan 25, 2009, at 7:35 PM, wubbie wrote:
>
> > then, back to my original question.
> > They (dorun do all) differe ONLY in return value.
> > Then how come one forces eval and the other not?
>
> Both force evaluation. Is there something that makes you think  
> otherwise?
>
> In the case of dorun, the members of the sequence are evaluated and  
> then immediately thrown away.
>
> In the case of doall, the members of the sequence are evaluated and  
> the entire sequence is kept in memory and returned. None of the  
> members are thrown away because the "coll" argument (which is also the  
> returned value) holds a "reference" (in the java sense) to the first  
> item, the first item holds a reference to the second item, and so on  
> all the way down the chain.
>
> --Steve
>
>  smime.p7s
> 3KViewDownload
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to