Urs Liska <li...@openlilylib.org> 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 > https://github.com/openlilylib/oll-core/blob/master/internal/properties.scm#L566-L611 > (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 called. 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