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))))
>
> 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
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---