| Andr� Thieme <address.good.until.2009.may...@justmail.de> wrote:
| > There is no need for a lambda macro which allows people to omit the
| > #' in front of a lambda, if that #' really makes things clearer.
| > The #' itself is also not needed but still I see people using that
| > reader macro. Why do these macros exist?
| I write functions all the time and almost never write (lambda ...)
| without a preceding #'. I do this by preference. I find it nicely
| regular as a way of naming functions and I do not find it visually
| To me, #' means "I'm about to name a function." I consider (lambda
| (x) x) to be a "name" for an anonymous function, so it's a kind of
| name, just like when someone asks you who owns an object, you can
| either say "John" or "that guy over there". Bpth are noun phrases,
| but each of a different kind. The thing after #' is a name. So #'foo
| or #'(lambda (x) ...) are the two kinds of "names" for functions.
I understand what Kent's saying here, but I would like to share
a different view [not "better", just different]: I also think of
FUNCTION or #' as "I'm about to name a function", which is precisely
why I *don't* use #' in front of LAMBDA!! Why is this? It's probably
because of my Scheme background, where capturing free variables in a
closure is a much more common coding style than in CL, and where it's
a little more obvious that typing (LAMBDA ...something...) is *not* so
much "naming" a function as *creating* one!!
That is, to me (LAMBDA ...something...) is an executable form [albeit
a special form] which returns a value, a new function which has closed
over its free variables with the current dynamic values of the lexically
visible bindings in the current environment. This doesn't seem like
"naming" to me so much as "creating", since the resulting closure you
get back is [potentially] *different* every time you execute the LAMBDA.
Contrast that with (FUNCTION FOO), which always gives you the *same*
[functional value of] FOO every time [modulo runtime redefinitions].
Yes, a LAMBDA form with no free variables is also a "constant" name,
which is why I don't argue with Kent's view that "naming" is the more
important aspect. I suspect [but will wait for him to confirm or deny]
that most of the LAMBDAs he writes don't depend on captured free variables.
But for me, who even in CL uses lots of "functions which generate functions"
[i.e., non-trivial closures], the reverse is true. The function-creating
role of LAMBDA is paramount, and the "naming" aspect is actually rather
unreliable, since different executions of the LAMBDA form produce different
results [not something I associate with being "the" name of something].
That's why I, for one, am *very* glad that the LAMBDA *macro* exists
in CL, so that I can use it -- *without* the #' or FUNCTION prefix --
to make it very clear when I'm generating a value [a closure] and not
"just" naming something static & anonymous. ;-} ;-}
Rob Warnock <firstname.lastname@example.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607