hmm...I don't understand why clojure when and if simultaneously? What
is the diffirences between them and when I should use one instead
another one?

Disregarding all of the practical benefits (such as an implicit do): languages often incorporate apparently redundant constructs because one of the roles of a language is to communicate your higher-level intent.

Using (when (foo) (bar) (baz)) instead of (if (foo) (do (bar) (baz))) communicates some subtle distinctions to other programmers, despite their equivalence to the compiler: you're telling other humans that you didn't accidentally omit the 'else' clause; that you don't expect any code to run if the condition is false; that you're intentionally returning nil for false; that you're probably doing something with side-effects.

There are more subtle clues that you'll pick up in certain people's styles, too -- I'm sure my use of when has a very different pattern to a Java guy's, colored by my Common Lisp experience.

It would be a pretty dull programming language that doesn't allow you the leeway to express yourself.

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

Reply via email to