On Wed, Mar 4, 2009 at 4:43 AM, David Sletten <da...@bosatsu.net> wrote:
>
> Conversely, "when" says "side effect". This is clear for 2 reasons.
> First, there is no "else" clause, so "when" doesn't really work as an
> expression. Furthermore, the forms in the "when" body are evaluated
> in an implicit "do". Since only the final value is returned, any of
> the earlier expressions in the "when" body are useful only for their
> side effects.

That's interesting.  Perhaps I haven't looked carefully enough at when
it's idiomatic to use 'when' in Clojure, but my impression has been
that anytime that returning 'nil' is ok for the else case, using
'when' is acceptible.

> I don't think "reduce" would actually work here. As you see, the test
> (>= n arabic) determines whether we continue working with the
> original num-list or proceed to the tail. I'm not sure of how to get
> that behavior with "reduce".

You're absolutely right, 'reduce' will not work here. I missed that
the 'if' was making the decision to loop again or not, and that based
on numeric comparison.

--Chouser

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