Re: markup function accepting either markup or markup list as argument

2024-06-22 Thread Werner LEMBERG
> The documentation clearly states: > > > >Arguments are distinguished according to their type: >• a markup, corresponding to type predicate ‘markup?’; >• a list of markups, corresponding to type

Re: markup function accepting either markup or markup list as argument

2024-06-22 Thread David Kastrup
Werner LEMBERG writes: >> The real question is what you actually are trying to achieve here. > > I want to write a user-friendly markup command that can accept either > a markup or a markup list as arguments. Example: > > ``` > % \ornament > \markup \ornament \number ♭ > \mu

Re: markup function accepting either markup or markup list as argument

2024-06-22 Thread Werner LEMBERG
>> I want to write a user-friendly markup command that can accept either >> a markup or a markup list as arguments. Example: >> >> ``` >> % \ornament >> \markup \ornament \number ♭ >> \musicglyph "scripts.turn" >> \number ♮ >> \markup \ornament { \number ♭ \

Re: need help building a Scheme function

2024-06-22 Thread Kieren MacMillan
Hi again, > There is no necessity to return a new NoteEvent; you can just change > pitch on the existing one. > > Music functions are allowed to modify their music arguments in place. This is what I have so far, which appears to do what I want: %%% SNIPPET BEGINS \version "2.25.11" adjustPitc

Re: need help building a Scheme function

2024-06-22 Thread David Kastrup
Kieren MacMillan writes: > Hi again, > >> There is no necessity to return a new NoteEvent; you can just change >> pitch on the existing one. >> >> Music functions are allowed to modify their music arguments in place. > > This is what I have so far, which appears to do what I want: > > %%% SNIPP

Re: need help building a Scheme function

2024-06-22 Thread Kieren MacMillan
Hi David, > This will also adjust eis and eses to e. Note names are numbers and can > be compared with = . (make-music 'NoteEvent m) is silly and creates an > unnecessary copy. You can just use m instead. Thanks — current version: %%% SNIPPET BEGINS \version "2.25.11" adjustPitch = #(define

Re: need help building a Scheme function

2024-06-22 Thread David Kastrup
Kieren MacMillan writes: > I tried a few times, but got errors (about returning > unspecified). Hints appreciated. for-some-music does not return music. It works on music in-place. So the last thing in your music function must not be for-some-music but rather the music that you have been worki

Re: need help building a Scheme function

2024-06-22 Thread Kieren MacMillan
Hi David, > for-some-music does not return music. It works on music in-place. So > the last thing in your music function must not be for-some-music but > rather the music that you have been working on. So… %%% SNIPPET BEGINS adjustPitch = #(define-music-function (pitchIn pitchOut music) (ly:p