Thomas Morley <[email protected]> writes:

> 2016-03-23 12:45 GMT+01:00 David Kastrup <[email protected]>:
>
>> I think that the old
>>
>> drumPitchNames #'slap = #'slap
>>
>> has worked for a long long time (quite earlier than 2.12).  But it's
>> quite underdocumented.  I think it caught me by surprise when I first
>> discovered it in the parser.
>
> /lilypond-git (master)$ git grep 'drumPitchNames'
> Documentation/misc/ChangeLog-2.10:      * ly/drumpitch-init.ly
> (drumPitchNames): add tamtam.
> lily/parser.yy:         SCM nn = parser->lexer_->lookup_identifier
> ("drumPitchNames");
> lily/parser.yy:         SCM nn = parser->lexer_->lookup_identifier
> ("drumPitchNames");
> ly/drumpitch-init.ly:drumPitchNames =
>
> Is not exactly what I would call _under_documented.

I was talking about the alist assignment syntax, not drumPitchNames in
particular.

> Though, I'm not sure I understand all yet.
>
> Do the following two lines the same?
> drumPitchNames.bla = #'bla
> #(set! drumPitchNames (acons 'foo 'foo drumPitchNames))

You mean, apart from 'bla not being 'foo ?  Yes.

> How to put in a list? The following looks a bit clumsy.
> #(for-each
>    (lambda (sys) (set! drumPitchNames (acons sys sys drumPitchNames)))
>    '(aa ab ac ad ae af)))
> #(pretty-print (take drumPitchNames 10))

drumPitchNames.aa = #'aa
drumPitchNames.ab = #'ab
...


Programmatically, I'd not set drumPitchNames repeatedly.  Just use

drumPitchNames =
#(fold (lambda (n l) (acons n n l)) drumPitchNames '(aa ab ac ad ae af))

-- 
David Kastrup

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to