I've added letfn, which lets you define mutually recursive local
functions a la CL's labels.
(defn ring [n]
(letfn [(a [n] (if (zero? n) n (b (dec n))))
(b [n] (if (zero? n) n (c (dec n))))
(c [n] (if (zero? n) n (a (dec n))))]
(c n)))
(ring 1000)
Note this is still subject to stack limits, i.e. no TCO, so please
don't report your StackOverflowErrors. Useful for bounded data only.
Rich
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---