Thank you Simon for the explanation. I think I will try to avoid it as much as possible but not more than that:)
P.S. Be patient with my English.... On Thu, Apr 28, 2016 at 2:05 PM, Simon Albrecht <simon.albre...@mail.de> wrote: > On 28.04.2016 11:52, Gianmaria Lari wrote: >> >> Dear Harm, >> >> some weeks ago replying to me, you used a variable name syntax that I >> didn't know: >> >>> mynote.7 = ..... >> >> I see the compiler didn't complain and having the possibility to use >> number in the variable name would be very practical (at least for me). >> But is it a "standard programming style"? > > > It’s a quite new feature, undocumented and doesn’t work in all > circumstances, but yes it is very useful. I don’t know whether you are > familiar with Scheme; anyway here’s an explanation of the feature which I > hope is correct: > mynote.7 = "foo" > uses an alist > (<http://lilypond.org/doc/v2.19/Documentation/extending/scheme-compound-data-types#association-lists-_0028alists_0029>) > to store the values, or more precisely, it assigns the value 1 to the key > ‘7’ of the alist ‘mynote’. I.e. if mynote wasn’t defined previously, the > Scheme equivalent of the example line would be: > #(define mynote `((7 . "foo"))) > If it _was_ defined previously, it would be: > #(set! mynote (assoc-set! mynote 7 "foo")) > <http://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/Adding-or-Setting-Alist-Entries.html#Adding-or-Setting-Alist-Entries> > > And \mynote.7 can be used to reference the value for the key 7 in the alist > mynote. So for practical purposes, it’s /almost/ like you had a variable > named ‘mynote.7’. But there are some caveats, e.g.: > > \score { \mynote.7 } won’t work, you need to wrap it: > \score { > { \mynote.7 } > } > or > \score { > << \mynote.7 >> > } > > Also, in lyricmode you need spaces around the dot separator: \lyricmode { > \mynote . 7 }. > > HTH, Simon _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user