help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: syntax: anonymous vs. named functions


From: Andreas Politz
Subject: Re: syntax: anonymous vs. named functions
Date: Mon, 17 Nov 2008 09:08:42 +0100
User-agent: Mozilla-Thunderbird 2.0.0.17 (X11/20081018)

Drew Adams wrote:
[...]

The reason that a lambda form is not allowed as a functional COLLECTION argument
is that although a lambda form can generally be used as a function, it
_evaluates_ to a list (whose car is `lambda' etc. - that is, to itself).

And since COLLECTION can also be an explicit list of candidates, it would be
problematic to distinguish the intention of passing an argument whose value is a
list that has the form (lambda (...) ...). This is a feature of Lisp's
program=data quality.

Mhh, more likely a problem of elisp.

CL-USER> (functionp #'(lambda nil))
T
CL-USER> (functionp '(lambda nil))
NIL

In elisp both expressions evaluate as T. I like the CL feature better ;)

-ap

ps, does the collection function really need to accept all three
arguments (string, predicate and t/nil/lambda)?

Yes. It need not _use_ all three, or even any of them, to do its job, but it
must accept three arguments. The primitive Emacs completion functions depend on
it having such a signature.

i know you say that
(do-completion (string)) is a function application, but what would a
function look like in this case?  just like this: do-completion (that
is, a simple evaluated symbol)?

Correct. You would pass the function `do-completion' this way:

 (completing-read "Name: " #'do-completion nil t)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]