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: stk
Subject: Re: Scheme question on strict substitution
Date: Thu, 30 Nov 2006 00:56:12 -0500 (EST)

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?

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?

-- Tom

**************************************************************

On Wed, 29 Nov 2006, Mats Bengtsson wrote:

> No, this doesn't work.
>
> What does work is
> \version "2.10.0"
>
> fraction = #(define-music-function (parser location music) (ly:music?)
>      #{
>         \tweak #'text #tuplet-number::calc-fraction-text $music
>      #})
>
>
> \relative c'{
> \fraction
>         \times 2/3 {
>             c'8 c'8 c'8
>         }
>
> }
>
> However, what is the reason to use \tweak at all? Why not simply do
> an ordinary \once \override:
>
> \version "2.10.0"
>
> fraction = \override TupletNumber #'text =
> #tuplet-number::calc-fraction-text
>
> \relative c'{
> \fraction
>         \times 2/3 {
>             c'8 c'8 c'8
>         }
> }
>
>
>    /Mats
>
> address@hidden wrote:
> > Hello,
> >
> > Does it work just to define this macro at the top level
> >
> >         fraction = \tweak #'text #tuplet-number::calc-fraction-text
> >
> > and then later in the music to write
> >
> >         \fraction
> >         \times 2/3 {
> >             c'8 c'8 c'8
> >         }
> >
> > Does LilyPond swallow that?
> >
> > -- Tom
> >
> > -------------------------------------------------
> >
> > Trevor Baca wrote:
> >
> > Hi,
> >
> > I frequently write
> >
> >         \tweak #'text #tuplet-number::calc-fraction-text
> >
> > before tuplets, like this:
> >
> >         \tweak #'text #tuplet-number::calc-fraction-text
> >         \times 2/3 {
> >             c'8 c'8 c'8
> >         }
> >
> > What's the best way to abbreviate to something like this?
> >
> >         \fraction
> >         \times 2/3 {
> >             c'8 c'8 c'8
> >         }
> >
> > I've tried this music function ...
> >
> >    fraction = #(define-music-function (parser location) ()
> >       #{
> >          \tweak #'text #tuplet-number::calc-fraction-text
> >       #})
> >
> > ... but get this parse error:
> >
> > Parsing...
> > <string>:3:9: error: syntax error, unexpected '}'
> >
> >          }361.ly:5:0: error: errors found, ignoring music expression
> >
> > Any suggestions for a good abbreviation?
> >
> >
>
> --
> =============================================
>       Mats Bengtsson
>       Signal Processing
>       Signals, Sensors and Systems
>       Royal Institute of Technology
>       SE-100 44  STOCKHOLM
>       Sweden
>       Phone: (+46) 8 790 8463
>         Fax:   (+46) 8 790 7260
>       Email: address@hidden
>       WWW: http://www.s3.kth.se/~mabe
> =============================================
>





reply via email to

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