On Mon, Feb 6, 2012 at 12:33 PM, Manuel Paccagnella
<manuel.paccagne...@gmail.com> wrote:
> For binding both vars and functions, what's preferred? Using only let for
> both:
>
> (let [capitals [...]
>      ask-capital (fn [] ...)
>      ...)
>
> or instead let coupled with letfn?
>
> (let [capitals [...]]
>   (letfn [(ask-capitals [...))

I'd usually just use let. The only advantage that I know of to naming
local functions with letfn is that you can put mutually recursive
functions in letfn, or, more generally, functions that refer to one
another in a circular manner. With plain let, functions later in the
let can refer to ones earlier in the let but not vice versa so you can
manage by putting them in the right order if there aren't any
circularities but you need letfn if there are circularities (barring
ugly hacks involving atoms or similar).

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

Reply via email to