it's more idiomatic to use *when* rather than *if* for cases where you 
won't be considering the false path.

(when (<= x y) z)

cond is used more as a multi-if with a drop out at the end (usually using 
":else" which because it's a keyword is "truthy" when evaluated).


On Wednesday, 19 February 2014 02:25:05 UTC, Laurent Droin wrote:
>
> Now that I have a better understanding of what "some" does (i didn't 
> interpret the doc properly), it does totally make sense that it would be 
> recursive, so that's great.
>
> While reducing my code with Johanna's feedback, I noticed I kept using 
> "cond" and not "if".
>
> Is there any meaningful difference between
>
> (if (<= x y) z)
>
> and
>
> (cond (<= x y) z)
>
> ?
>
> I see that if is a special form and cone is macro. I haven't reached the 
> chapter about macros yet in  the book I'm reading (programming Clojure). 
> Not sure if it's relevant.
>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to