"Phil Holmes" <m...@philholmes.net> writes: > ----- Original Message ----- > From: "David Kastrup" <d...@gnu.org> > To: "Phil Holmes" <m...@philholmes.net> > Cc: "Urs Liska" <u...@openlilylib.org>; <lilypond-user@gnu.org> > Sent: Monday, March 31, 2014 2:44 PM > Subject: Re: Difference between # and $ > > >> "Phil Holmes" <m...@philholmes.net> 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 _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user