tags:

views:

455

answers:

1

When in practice should I use letfn vs. let for defining local functions? What about cases where I want both local functions and local not-functions?

+6  A: 

If all I need is a local function or 2... or 3... I'll letfn them. If I need to let a mix of functions and non-functions, I'll just use a normal let. letfning and letting would be a very verbose way to do this.

However, if you need mutual recursion through your local functions, you'll have to letfn them either way.

Short version: Use them when you think it looks better, and when it's convenient. There are no hard and fast rules for using either. They are just tools in the Clojure toolbox.

Have fun!

Rayne