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

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

Re: macro that uses local variables


From: Emanuel Berg
Subject: Re: macro that uses local variables
Date: Tue, 08 Aug 2023 03:27:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Heime wrote:

> I am using the rocket equation in this macro [...]
> 
> (defmacro booster-velocity-change
>     (specific-impulse standard-gravity initial-mass final-mass)
>   "Compute change of velocity using rocket equation."
>   `(* (* ,specific-impulse ,standard-gravity)
>         (log (mass-ratio ,initial-mass ,final-mass))) )

There is no reason to write a macro for this
simple computation.

> I want to change it such that the arguments are set as local
> variables

Lexical scope, defun, arguments, if need be `let'. It is
super easy.

If you start thinking "how do I solve my problem?" instead of
"how do I do <something> in Emacs", everything will be much
easier for you ...


-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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