(defn countdown [& {:keys [from] :or {from 10}}] (println from) (when (pos? from) (recur {:from (dec from)})))
Passing {:from (dec from)} instead of :from (dec from) works. Regards... -- Nurullah Akkaya http://nakkaya.com On Sun, Jun 6, 2010 at 2:22 PM, Jonas Enlund <jonas.enl...@gmail.com> wrote: > The function definition below fails with > "java.lang.IllegalArgumentException: Mismatched argument count to > recur, expected: 1 args, got: 2" > > (defn countdown [& {:keys [from] > :or {from 10}}] > (println from) > (when (pos? from) > (recur :from (dec from)))) > > Is it not possible to recur on a function which uses keyword > arguments? If so, is using loop/recur the correct workaround? > > - Jonas > > -- > 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 > -- 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