|
From: | Urs Liska |
Subject: | Understanding symbol-list? variable names |
Date: | Fri, 8 Jun 2018 11:31:44 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
I can store variables with symbol-list? names like so: \version "2.19.80" my.note. c'4 } my.note.two = { d'2 } { \my.note.one \my.note.two \my.note.one } It is also possible to store functions in such variables: my.function = #(define-music-function ()() #{ c'4 #}) However, it is not possible to *call* the function like retrieving the value above: { \my.function } yields "warning: ignoring non-music _expression_". But I can do { #(#{ \my.function #}) } My impression is that "\my.function" by itself retrieves the value, i.e. the stored function, rather than applying it, while the last example goes around some corners to actually doing what I want. I would like to find a smoother syntax to invoking functions like this because I'd like to explore the possibility to create a namespace of functions like \mylib.function-one, \mylib.function-two etc. But it would only make sense if there's a really easy end-user syntax, and to get there I'd have to first understand what is actually happening (in the parser?) when \my.function is encountered. I didn't see where this (rather new) option is documented, so I'd be happy about any pointers or even examples. Thanks |
[Prev in Thread] | Current Thread | [Next in Thread] |