Re: Bug: recur won't work in tail position within cond

2008-12-05 Thread Ralf Bensmann
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

Re: Bug: recur won't work in tail position within cond

2008-12-03 Thread puzzler
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

Re: Bug: recur won't work in tail position within cond

2008-12-03 Thread Brian Doyle
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 > >

Re: Bug: recur won't work in tail position within cond

2008-12-03 Thread harrison clarke
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

Bug: recur won't work in tail position within cond

2008-12-03 Thread puzzler
(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 --~--~-