emacs-devel
[Top][All Lists]
Advanced

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

Re: [elpa] externals/org 26ef5e3e5b: org-src: Use `sh-mode' for all the


From: Lynn Winebarger
Subject: Re: [elpa] externals/org 26ef5e3e5b: org-src: Use `sh-mode' for all the shells it can handle
Date: Mon, 17 Apr 2023 13:24:25 -0400

On Mon, Apr 17, 2023, 1:11 PM Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>     ELISP> (macroexpand '`(,@(list 1 2) a b c d))
>>     (append (list 1 2) '(a b c d))
>>     ELISP> (macroexpand '`(a b c d ,@(list 1 2)))
>>     (cons 'a (cons 'b (cons 'c (cons 'd (list 1 2)))))
>>     ELISP>
> Why is the former more efficient than the latter?

One allocates N₁+N₂ cons cells, then other only allocates N₁ cons-cells.
This is true regardless of how we macroexpand and byte-compile the code.
This only makes a diference for code that's executed several times
(i.e. not at toplevel).

I see - what you meant by "such ,@" was when the preceding elements are constant.  

I've seen a veteran Lisp programmer get bitten by side-effecting a list constructed with that feature of backquote.  

Lynn


reply via email to

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