On Tue, Jul 14, 2009 at 7:46 PM, Phil Hagelberg<[email protected]> wrote:
> I see. The way I usually see let-forms is having the argument list start
> on the same line as the "let" itself, which would look like:
>
>> (defn test-letfn [n]
>>   (letfn [(function1 [a b]
>>                      (+ (function2 a) sqr-n))
>>           (function2 [a]
>>                      (* 2 3))]
>>    (function1 8 10)))

When the function bodies are complex, you really want them to start
off as far to the left as possible, which is why I would start the
left bracket on the next line.  Also, it allows you to put in comment
lines explaining what the function does -- another important thing for
complex functions..

> It's unclear (to me at least) what letfn offers you over regular let,
> since functions are just values anyway:

In my silly example, nothing.  But if the functions are mutually
recursive, you can't do that with let.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to