emacs-devel
[Top][All Lists]
Advanced

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

Re: Distinguishing `consp` and `functionp`


From: Andreas Schwab
Subject: Re: Distinguishing `consp` and `functionp`
Date: Mon, 29 Jan 2024 17:17:14 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

On Jan 29 2024, João Távora wrote:

> I don't think there is much space for philosophy or debate in noting
> for example, that a list as lambda won't get byte-compiled like a
> true lambda form.
>
> (byte-compile '(let ((bla (lambda () (+ 42 42))))
>                  (funcall bla))) ;; -> (byte-code "\300\211 \207" [#[0
> "\300\207" [84] 1]] 2)
>
>
> (byte-compile '(let ((bla '(lambda () (+ 42 42))))
>                  (funcall bla)));; -> (byte-code "\300 \207" [(lambda
> nil (+ 42 42))] 1)

Functions should be quoted with function, not quote:

ELISP> (byte-compile '(let ((bla #'(lambda () (+ 42 42)))) (funcall bla)))
(byte-code "\300\211 \207"
           [#f(compiled-function
               ()
               #<bytecode 0x1980001536a5>)]
           2)

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



reply via email to

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