[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hash/backslash confusion
From: |
Carl Sorensen |
Subject: |
Re: hash/backslash confusion |
Date: |
Thu, 13 Aug 2009 11:52:12 -0600 |
On 8/13/09 10:37 AM, "Mark Polesky" <address@hidden> wrote:
> Carl Sorensen wrote:
>
>> Hope this helps. It was instructional to me to write it.
>
> Wow, thanks - that was a lot of info. I'm still trying to wrap my
> brain around it. But in the meantime, I've noticed something else
> confusing, and I'm wondering if you'd like to make any additional
> comments on this.
This is *exactly* the same issue.
Anything beginning with \ is a LilyPond string, and can only be alphabetic.
That's the rules for LilyPond.
Anything beginning with # is a Scheme expression, and follows the rules of
Scheme.
\applyOutput takes as its second argument a procedure, which is a scheme
expression.
\blanker is LilyPond parser input for a LilyPond string that evaluates to
the scheme expression blanker, which has a value of (lambda ...)
#blanker is LilyPond parser input for the scheme expression blanker
\blanker-2 won't work, because blanker-2 is *not* a valid LilyPond string.
#blanker-2 will work, because blanker-2 is a valid Scheme expression.
There is no \ string that can work with blanker-2. When Scheme names
contain numbers or -, the only way to get to them in LilyPond input is via
#, and this can only come in constructs where the parser will accept a
Scheme input, not where a string is needed.
HTH,
Carl
>
> I'm trying to figure it out, but it's still confusing. Any
> elucidation would be helpful.
> - Mark
>
> \version "2.13.4"
>
> %% procedure can be defined with "=" or scheme-style, and
> %% scheme-defined procedure names can have non-alphabetic characters.
>
> blanker =
> #(lambda (grob grob-origin context)
> (if (and (memq 'note-head-interface (ly:grob-interfaces grob))
> (eq? (ly:grob-property grob 'staff-position) 0))
> (set! (ly:grob-property grob 'transparent) #t)))
>
> #(define (blankerB grob grob-origin context)
> (if (and (memq 'note-head-interface (ly:grob-interfaces grob))
> (eq? (ly:grob-property grob 'staff-position) 0))
> (set! (ly:grob-property grob 'transparent) #t)))
>
> #(define (blanker-2 grob grob-origin context)
> (if (and (memq 'note-head-interface (ly:grob-interfaces grob))
> (eq? (ly:grob-property grob 'staff-position) 0))
> (set! (ly:grob-property grob 'transparent) #t)))
>
> % procedures can be dereferenced with either "#" or "\", but procedure
> % names with non-alphabetic characters can only use "#".
>
> \relative { e4 g8 \applyOutput #'Voice #blanker b d2 }
> \relative { e4 g8 \applyOutput #'Voice \blanker b d2 }
> \relative { e4 g8 \applyOutput #'Voice #blankerB b d2 }
> \relative { e4 g8 \applyOutput #'Voice \blankerB b d2 }
> \relative { e4 g8 \applyOutput #'Voice #blanker-2 b d2 }
>
> % this won't work
> % \relative { e4 g8 \applyOutput #'Voice \blanker-2 b d2 }
>
>
>