Edward Tsech <edts...@gmail.com> writes:

> java.lang.IllegalArgumentExcepdtion: if-let requires exactly 2 forms
> in binding vector(NO_SOURCE_FILE:1)
>
> Why doesn't "if-let" support any even amount of binding forms as "let"
> does?
>
> e.g.
> (if-let [x 1 y 2 z 3]
>   (+ x y z)
>   0) ; => 6
>
> (if-let [x 1 y nil z 3]
>   (+ x y z)
>   0) ; => 0

At least in my experience, it usually matters a lot which form actually
evaluated to nil.  But it's easy to write a macro `if-let-all' or so,
which would expand into

  (let [x 1 y nil z 3]
    (if (and x y z)
      (+ x y z)
      0))

if you really feel a need for it.

Bye,
Tassilo

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