Re: Scheme used badly: syntax problem
Graham King writes: > Many thanks David! > > (In the course of trying to convert the \note syntax, I discovered the > existence of \note-by-number which solved 90% of my problem. Sorry for > the confusing reference to \note.) Well, \note-by-number #1 #0 #UP is essentially the same as \note {2} #UP If you are not calculating note values, \note tends to have the simpler syntax. -- David Kastrup
Re: Scheme used badly: syntax problem
Many thanks David! (In the course of trying to convert the \note syntax, I discovered the existence of \note-by-number which solved 90% of my problem. Sorry for the confusing reference to \note.) On Sun, 2023-09-17 at 00:38 +0200, David Kastrup wrote: > Graham King writes: > > > I'm trying to convert a naive Scheme function which has been broken > > by > > the new syntax for \note. Some arithmetic gives me the index (in > > this > > MNWE, 96) to a list of pairs, foo, from which I want to extract > > some > > markup. > > > > The 300-LOC problem seems to boil down to this: > > > > %~~~ > > \version "2.25.7" > > > > #(define foo '((96 . #{ \markup { \note-by-number #1 #0 #UP }#}))) > > > > { c'1^\markup {#(cdr (assoc 96 foo))} } > > %~~~ > > > > Please could a kind Scheme expert point out the stupid and obvious > > mistake that has eluded me for several evenings? > > Uh, there isn't even \note in there? > > The problem in the above is a quoting problem: you mustn't quote > #{...#}, and you can avoid quoting it using quasiquote and unquote: > > \version "2.25.7" > > #(define foo `((96 . ,#{ \markup { \note-by-number #1 #0 #UP }#}))) > > { c'1^\markup {#(cdr (assoc 96 foo))} } >
Re: Scheme used badly: syntax problem
Graham King writes: > I'm trying to convert a naive Scheme function which has been broken by > the new syntax for \note. Some arithmetic gives me the index (in this > MNWE, 96) to a list of pairs, foo, from which I want to extract some > markup. > > The 300-LOC problem seems to boil down to this: > > %~~~ > \version "2.25.7" > > #(define foo '((96 . #{ \markup { \note-by-number #1 #0 #UP }#}))) > > { c'1^\markup {#(cdr (assoc 96 foo))} } > %~~~ > > Please could a kind Scheme expert point out the stupid and obvious > mistake that has eluded me for several evenings? Uh, there isn't even \note in there? The problem in the above is a quoting problem: you mustn't quote #{...#}, and you can avoid quoting it using quasiquote and unquote: \version "2.25.7" #(define foo `((96 . ,#{ \markup { \note-by-number #1 #0 #UP }#}))) { c'1^\markup {#(cdr (assoc 96 foo))} } -- David Kastrup