unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Lambdas for beginners broken - help, please
@ 2024-07-24  8:43 Eduardo Ochs
  2024-07-24 13:12 ` Michael Heerdegen via Users list for the GNU Emacs text editor
  2024-07-24 16:54 ` tpeplt
  0 siblings, 2 replies; 14+ messages in thread
From: Eduardo Ochs @ 2024-07-24  8:43 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,

I always present Emacs to beginners starting by Lisp, with this
approach:

  http://anggtwu.net/eev-intros/find-eev-quick-intro.html#2
  http://anggtwu.net/eev-intros/find-eev-quick-intro.html#3

and when I show Emacs to friends who are programmers - in some sense -
and they like it, I usually tell them to read my short tutorial on
elisp as soon as possible, and try its examples:

  http://anggtwu.net/eev-intros/find-elisp-intro.html

But one or two days ago I compiled a current Emacs from git, and I saw
that many functions in eev don't work anymore. Apparently the problem
is here:

  (info "(elisp)Function Cells")
  https://www.gnu.org/software/emacs/manual/html_node/elisp/Function-Cells

Now the htmlized version of the manual says this,

  (defun bar (n) (+ n 2))
  (symbol-function 'bar)
    ;; -> (lambda (n) (+ n 2))

the current info manual says this,

  (defun bar (n) (+ n 2))
  (symbol-function 'bar)
    ;; -> #f(lambda (n) [t] (+ n 2))

and if I run the code myself(*) I get this:

  (defun bar (n) (+ n 2))
  (symbol-function 'bar)
    ;; -> #[(n) ((+ n 2)) nil]

I have lots of code and lots of tutorials that rely on the idea that
when lexical binding is nil then after a

  (defun bar (n) (+ n 2))

the value of

  (symbol-function 'bar)

will be a lambda expression in this sense,

  (info "(elisp)Lambda Expressions")
  http://www.gnu.org/software/emacs/manual/html_node/elisp/Lambda-Expressions

_as a list_, not as a "function object that is not a list".

What do I need to read to learn how to adapt my code to the new
behavior of Emacs?

  Thanks in advance...
    Eduardo Ochs
    http://anggtwu.net/#eev


(*): I tried both the standard `C-x C-e' and my favorite way of
calling it, that uses the key `M-e' and `(eval <obj> t)'.



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-07-25 14:53 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-24  8:43 Lambdas for beginners broken - help, please Eduardo Ochs
2024-07-24 13:12 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-24 16:43   ` Eduardo Ochs
2024-07-24 20:03     ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-24 22:06       ` Eduardo Ochs
2024-07-25  5:18       ` Eli Zaretskii
2024-07-25  9:44         ` Eduardo Ochs
2024-07-25 11:33           ` Eli Zaretskii
2024-07-25 12:49             ` Eduardo Ochs
2024-07-25 14:53               ` Eli Zaretskii
2024-07-24 16:54 ` tpeplt
2024-07-24 18:49   ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-24 19:29     ` tpeplt
2024-07-24 19:58       ` Michael Heerdegen via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).