lilypond-user
[Top][All Lists]
Advanced

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

Re: Scheme question on strict substitution


From: Mats Bengtsson
Subject: Re: Scheme question on strict substitution
Date: Thu, 30 Nov 2006 08:47:08 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060909)



address@hidden wrote:
Hello,

Does it work just to define this macro at the top level

        fraction = \tweak #'text #tuplet-number::calc-fraction-text

No, this doesn't work.

OK, but I have a question.  It is common to write such things as

      push = \once \override NoteColumn #'extra-X-extent = #'(0 . 2)

and then later to use \push before a note in the music.
However the above definition of fraction doesn't yield a valid
\fraction macro call, as you pointed out.

Is there any clear criterion for knowing in advance whether a given
expression for a macro definition will actually work?

The syntax of \tweak is
\tweak symbol value music_expression
where music_expression is the music expression you want the tweak to
apply to. You can only define a macro for a complete syntactical expression
(I know that this is a somewhat vague definition), whereas you tried to
define a macro for only half of it. It may help your understanding to know
that \tweak itself is implemented as a music function taking 3 arguments.
What I get out of your function definition of fraction (below) is that
\fraction is intrinsically a function that has to be followed by a music
argument.  But even though

      \once \override NoteColumn #'extra-X-extent = #'(0 . 2)

would have to be followed by a note to make any sense, that doesn't
seem to make it a function-with-one-argument.  I accept the fact that

      \tweak #'text #tuplet-number::calc-fraction-text

*is* a function-with-one-argument, but in general how is one supposed to
know whether a given expression is just a state-creator or it's a
function-with-one-or-more-arguments?

The only strict definition of the input syntax is the source code of the parser
lily/parser.yy in the source code tree. Also, more and more features of the
syntax are implemented as music functions instead of being hard coded
into the parser, so it's not entirely easy to figure out, apart from using trial
and error.

  /Mats




reply via email to

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