Hacker News new | comments | show | ask | jobs | submit login
What's in an Emacs Lambda? (nullprogram.com)
80 points by eaguyhn on Dec 16, 2017 | hide | past | web | favorite | 4 comments



The article doesn't state it, but

    '(lambda (x) x)
is actually shorthand for

    (quote (lambda (x) x))
And then the distinction between them is explained right inside emacs. C-h f quote and C-h f lambda


The difference is when an expression is to be evaluated. Back quote and friends are evaluated by the read function. These expressions are (or at least should be) functions on syntactic forms - syntax transformers. People call them macros. Of course they could have been misused in many cryptic ways.


> These expressions are (or at least should be) functions on syntactic forms - syntax transformers.

I don't really agree with this. Backquote is just shorthand for a bunch of consing that makes the end result more clear. Macros are one application where being able to sort of template lists is very useful, but they're not the only one. As well, I think the tendency for people to learn backquote as a companion to defmacro tends to confuse people about how defmacro works.


There is then some additional confusion coming from the fact that there are diffetent ways how backquote/quasiquote is really implemented by the reader:

For CL it is entirely valid to implement whole logic of backquote in the ` read macro and expand it into some nested combination of list, append and quote at read time. Scheme specifies what ` and friends expand into which then is implemented as normal m8acros (which is also valid and somehow common implementation in CL). Elisp is slightly weird in that ` originally was normal macro and thus ` read macro expands `(foo) into (` foo).




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: