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

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

Re: Compiling a recursive macro


From: Michael Heerdegen
Subject: Re: Compiling a recursive macro
Date: Sat, 13 Jun 2020 11:49:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Douglas Lewan <d.lewan2000@gmail.com> writes:

> I managed to lose the last response to my original question, the one
> with the case_ macro. Here it is for reference:

BTW, if you didn't know: `macroexpand-1', `macroexpand' and
`macroexpand-all' are your fried when playing with macros.

BTW2, a small problem with your posted version is that it adds one `let'
binding per branch, but only the outermost is needed:

(macroexpand-all '(case_ x ((1 2) t) (3 nil)))

==>

(let ((#1=#:g772 x))
  (if (member #1# '(1 2))
      t
    (let ((#2=#:g773 #1#))      ;; <--- here
      (if (member #2# '3)
          nil nil))))

That is not harmful but a bit inelegant and inefficient.


Michael.



reply via email to

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