Imo, that makes the let version even better. The Clojure compiler doesn't
to allow circular dependencies, so I would consider the letfn behavior as
"surprising" and therefore unideal.

On Thu, Nov 20, 2014 at 2:21 PM, Dan Girellini <d...@longhands.org> wrote:

> Using letfn allows the local functions to reference each other
> arbitrarily. In your example, f2 can call f1 but not vice versa.
>
> On Thu, Nov 20, 2014 at 11:08 AM, Alex Baranosky <
> alexander.barano...@gmail.com> wrote:
>
>> letfn has no value imo. It is an unwritten stylistic rule I have to never
>> use it.  Why introduce a new macro syntax for something that could just as
>> easily be written as?:
>>
>> (let [f1 (fn [] ...)
>>        f2 (fn [] ...)]
>>   (+ (f1) (f2)))
>>
>>
>> On Thu, Nov 20, 2014 at 12:41 PM, henry w <henryw...@gmail.com> wrote:
>>
>>> I never heard of letfn before. that looks like a clear way to do what i
>>> need.
>>>
>>> just found this stackoverflow thread which is relevant:
>>> http://stackoverflow.com/questions/23255798/clojure-style-defn-vs-letfn
>>>
>>> On Thu, Nov 20, 2014 at 3:34 PM, Alex Baranosky <
>>> alexander.barano...@gmail.com> wrote:
>>>
>>>> I'd structure my app like this.
>>>>
>>>> Say there's one "pages" ns with code for different webpages
>>>>
>>>> pages/index is a pretty short function
>>>> pages/dashboard is a more elaborate function and has two subcomponents:
>>>> ->analytics, and ->user-info
>>>> pages.analytics/->analytics
>>>> pages.user-info/->user-info
>>>>
>>>> On Thu, Nov 20, 2014 at 9:23 AM, Tassilo Horn <t...@gnu.org> wrote:
>>>>
>>>>> henry w <henryw...@gmail.com> writes:
>>>>>
>>>>> > you have understood my arguments pretty much. again the thing that
>>>>> > bothers me is that f and g are logically part of x only, but are
>>>>> > visible from y and z (even if and and y are declared higher up, the
>>>>> > same problem applies to their own related, private fns and x).
>>>>>
>>>>> Then declare f and g inside of x using `let' or `letfn'.
>>>>>
>>>>> Bye,
>>>>> Tassilo
>>>>>
>>>>> --
>>>>> 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
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Clojure" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to clojure+unsubscr...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>
>>  --
>> 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
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to