Either this, or use the "when" form.
http://clojuredocs.org/clojure_core/clojure.core/when

2011/7/11 Tassilo Horn <[email protected]>:
> Antonio Recio <[email protected]> writes:
>
> Hi Antonio,
>
>> I get the error "Too many arguments to if" with this. Do you have any
>> suggestion?
>
> `if' expects exacly one test, one then-form, and one else-form.  Your
> first and second `if' contain two forms in else.  You have to wrap them
> in a `do'.
>
> --8<---------------cut here---------------start------------->8---
> (defn make-tree [tree [n1 n2 n3 n4]]
>  (.addItem tree n1)
>  (if (empty? n2)
>    (.setChildrenAllowed tree n1 false)
>    (do
>      (doto tree
>        (.addItem n2)
>        (.setParent n2 n1)
>        (.expandItemsRecursively n1))
>      (if (empty? n3)
>        (.setChildrenAllowed tree n2 false)
>        (do
>          (doto tree
>            (.addItem n3)
>            (.setParent n3 n2)
>            (.expandItemsRecursively n2))
>          (if (empty? n4)
>            (.setChildrenAllowed tree n3 false)
>            (do
>              (doto tree
>                (.addItem n4)
>                (.setParent n4 n3)
>                (.expandItemsRecursively n3)
>                (.setChildrenAllowed n4 false)
>                tree))))))))
> --8<---------------cut here---------------end--------------->8---
>
> Bye,
> Tassilo
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> 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 post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to