[Top][All Lists]

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

Re: Handling quoted lists

From: David Kastrup
Subject: Re: Handling quoted lists
Date: Sat, 05 Sep 2020 18:07:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Urs Liska <> writes:

> I'm feeling totally stupid, but after hours of nightly poking and
> ly:message "debugging" around I'm at least at a point where I can ask
> concrete questions instead of an MWE.
> In 
>  (may not be the latest state!) I'm trying to create a macro and get
> messed up with quoting etc.

Let me be very clear here: the _sole_ difference between a macro and a
function is that when evaluating a function call, the function's
arguments are read, then every argument is evaluated, the function is
called with the evaluated arguments and the resulting value is returned.

In contrast, a macro's arguments are read, then the macro is called with
unevaluated arguments and the resulting value is evaluated afterwards to
make up the resulting value.

In either case, the arguments are read before any evaluation happens.
And in either way, there is exactly one level of evaluation happening,
for functions before they get called, and for macros after they get

If you have something like

bla = #(define-music-function (blub) (symbol-list?)
         (my-macro blub))

Then my-macro will receive a single symbol as argument, and that symbol
is blub .  Assigning any meaning to blub will happen if the symbol blub
appears in the return value from my-macro, in which case it will get
replaced by the value received from calling bla.

That makes macros be of very limited usefulness for processing
expressions specified as music function arguments.

David Kastrup

reply via email to

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