On Feb 28, 2009, at 2:38 PM, Rich Hickey wrote:

>
> 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.
>

Do you advocate usage of 'letfn' and 'let' similar to the distinction  
between LABELS and FLET in CL? In other words, FLET implies non- 
recursive local function definition whereas LABELS suggests  
(mutually) recursive function(s).

So,
(letfn [(f [x] (+ x 2))] (f 8)) ; LABELS
should ideally be:
(let [f (fn [x] (+ x 2))] (f 8)) ; FLET

Aloha,
David Sletten


--~--~---------~--~----~------------~-------~--~----~
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 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to