[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Difference between # and $
From: |
David Kastrup |
Subject: |
Re: Difference between # and $ |
Date: |
Mon, 31 Mar 2014 16:06:18 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
"Phil Holmes" <address@hidden> writes:
> ----- Original Message -----
> From: "David Kastrup" <address@hidden>
> To: "Phil Holmes" <address@hidden>
> Cc: "Urs Liska" <address@hidden>; <address@hidden>
> Sent: Monday, March 31, 2014 2:44 PM
> Subject: Re: Difference between # and $
>
>
>> "Phil Holmes" <address@hidden> writes:
>>
>>> I've read
>>> http://lilypond.org/doc/v2.19/Documentation/extending/lilypond-scheme-syntax
>>> (as no doubt, Urs has) and tried to use $ in place of #. Can't get it
>>> to compile. So, taking the following note doubler, how would $ be
>>> used instead of #?
>>>
>>> dubble = #(define-music-function( parser location arg )
>>> (ly:music?)
>>> #{ $arg $arg #}
>>> )
>>>
>>> { c'' \dubble c' }
>>
>> Huh? Which # would you even want to replace here? #{ ... #} is inside
>> of Scheme. $arg already uses a $.
>>
>> This code works fine as written.
>
> Er - yes. I know it works fine. I ran it. However, the page I refer
> to above says "Another way to call the Scheme interpreter from
> LilyPond is the use of dollar $ instead of a hash mark for introducing
> Scheme expressions". So my presumption was that
> "#(define-music-function" is "a hash mark for introducing Scheme
> expressions" and could be replaced by a $. But if I do that, it fails
> to compile.
Well, as mentioned in the documentation, $xxx is the same as \xxx. It's
accurate that one effect that is not explicitly listed is that if $xxx
or \xxx happen to evaluate to a music function, that music function is
called.
If you wrote
dubble = $(define-music-function( parser location arg )
(ly:music?)
#{ $arg $arg #}
)
{ c'' c' }
{ \dubble }
Then this would be similar to
dubble = { { c'' c' } { c'' c' } }
{ \dubble }
because the music function is called right after its definition. The
same happens with your example, but the \dubble occuring inside of your
music function argument is not yet defined.
--
David Kastrup
- Difference between # and $, Urs Liska, 2014/03/29
- Re: Difference between # and $, David Kastrup, 2014/03/29
- Re: Difference between # and $, Urs Liska, 2014/03/31
- Re: Difference between # and $, David Kastrup, 2014/03/31
- Re: Difference between # and $, Phil Holmes, 2014/03/31
- Re: Difference between # and $, David Kastrup, 2014/03/31
- Re: Difference between # and $, Urs Liska, 2014/03/31
- Re: Difference between # and $, Phil Holmes, 2014/03/31
- Re: Difference between # and $,
David Kastrup <=