In Clojure the extra () around case and expr are skipped if no function call
is made. Have a look at clojure.org/api
-Ralf
On Thu, Dec 4, 2008 at 5:54 AM, harrison clarke <[EMAIL PROTECTED]> wrote:
> did cond change syntax?
>
> last i checked, it was
>
> (cond (case) (expr)
>
> (case) (e
Whoops, I was thinking in Scheme. Thanks for pointing out my mistake,
Mark
--~--~-~--~~~---~--~~
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 unsubscr
This seems to work for me:
(defn sub-til-0 [n]
(cond
(zero? n) 0
:else (recur (dec 1
I'm not sure what those extra ['s are for in your example.
On Wed, Dec 3, 2008 at 9:39 PM, puzzler <[EMAIL PROTECTED]> wrote:
>
> (defn sub-til-0 [n]
> (if (zero? n) 0 (recur (dec 1
>
>
did cond change syntax?
last i checked, it was
(cond (case) (expr)
(case) (expr)
)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clojur
(defn sub-til-0 [n]
(if (zero? n) 0 (recur (dec 1
works but the equivalent
(defn sub-til-0 [n]
(cond
[(zero? n) 0]
[:else (recur (dec 1))]))
does not.
Recursion is already limited enough in Clojure... give us recur in
tail position within cond! :)
Thanks,
Mark
--~--~-