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

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

Re: Emacs documentation is bad


From: Ben Bacarisse
Subject: Re: Emacs documentation is bad
Date: Sun, 09 Sep 2018 22:10:42 +0100

John Stone <johnrstone2011@gmail.com> writes:

> lambda expression is a function which can appear wherever a function name
> can appear? bullshit, delete the lies from the manual

I don't think they are lies.  I think you are a (rude) Scheme programmer
who does not know that traditional Lisps like Common Lisp and Emacs Lisp
can't call closures without funcall (or apply).

This:

>> (
>>  (
>>   (lambda (f)
>>     (lambda (x)
>>       (list f x)))
>>   'g
>>   )
>>  'y
>>  )

evaluates to '(g y) in Scheme but it ill-formed in Common Lisp and Emacs
Lisp.  In Common Lisp you would write

  (funcall ((lambda (f) (lambda (x) (list f x))) 'g) 'y)

but in in Emacs Lisp you also have to have lexical binding on in the
buffer:

  (setq lexical-binding t)
  (funcall ((lambda (f) (lambda (x) (list f x))) 'g) 'y)

The fact that you need funcall to call a closure does not contradict the
statement in manual.  The same is true if we use a named function:

  (defun named (f) (lambda (x) (list f x)))
  (funcall (named 'g) 'y)

Using ((named 'g) 'y) will not work but notice how in the funcall
version the function name can indeed be replaced by the lambda
equivalent.

>>> this crashes emacs but try to figure out why from docs and you're shit
>>> out of luck and just wasted half a fucking day

I get the feeling you don't really want an explanation!  But I decided
to post this anyway because other reader might be interested and it
helps to keep the archive clear on unanswered questions.

-- 
Ben.


reply via email to

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