Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion thisfn is no more
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rich Hickey  
View profile  
 More options Feb 3 2008, 10:11 am
From: Rich Hickey <richhic...@gmail.com>
Date: Sun, 3 Feb 2008 07:11:47 -0800 (PST)
Local: Sun, Feb 3 2008 10:11 am
Subject: Re: thisfn is no more
On Feb 1, 9:21 am, Rich Hickey <richhic...@gmail.com> wrote:

> The most likely alternative is simply allowing a symbol to appear
> between fn and [:

> (fn foo [args] ...)

and, despite of a lack of counterexamples, that is what I have done
for now.

Now you can (optionally) put a symbol between fn and [ and that name
will be in scope in the body of the fn definition, where it will refer
to the fn itself. This will allow for recursive anonymous functions.
defn does this in its expansion.

> but it will lead to a lot of:

> (let [foo (fn foo [args] ...)]

> and people wondering why they have to say foo twice.

Interestingly, when changing those parts of Clojure that let a
recursive fn I always chose 'this' for the fn name, not the let name.
It seemed clearer, and isolated the let-bound name to the let, so if
it needed to be renamed I wouldn't have to touch the fn body.

I've also removed the injection of the let name into the fn
expression. Even if I revisit that in the future, I won't take away
the anonymous fn naming syntax.

Rich


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.