David Kastrup <d...@gnu.org> writes:

> David Kastrup <d...@gnu.org> writes:
>
>> Johan Vromans <jvrom...@squirrel.nl> writes:
>>
>>> David Kastrup <d...@gnu.org> writes:
>>>
>>>> bla = { <big series of notes> \tag #'here {} <another series of notes> }
>>>>
>>>> \pushToTag #'here { <some notes1> } \bla
>>>> \pushToTag #'here { <some notes2> } \bla
>>>
>>> Yes, this would be a way. Just like:
>>>
>>> before = { <big series of notes> }
>>> after = { <another series of notes> }
>>>
>>>   ...
>>>   \before
>>>   <some notes1>
>>>   \after
>>>   \before
>>>   <some notes2>
>>>   \after
>>>   ...
>>>
>>> However, I'd like to avoid the use of variables since that visually
>>> interrupts the flow of notes.
>>
>> If you don't want the flow of notes interrupted, what will mark the
>> location where <some notes1> and <some notes2> are to be spliced in?
>
> Perhaps you want something like
>
> #(define-macro (pattern args result)
>    `(define-music-function (parser location ,@args)
>       ,(make-list (length args) 'ly:music?)
>       (make-sequential-music (list ,@result))))

Actually, a recipe for trouble.  Make that

#(define-macro (pattern args result)
   `(define-music-function (parser location ,@args)
      ,(make-list (length args) 'ly:music?)
      #{ $@(list ,@result) #}))

so that all arguments will get passed through ly:music-deep-copy (by the
way, anybody impressed that unquote-splicing works inside of #{ $@... #} ?).

If you can't rely on the last version (?) of LilyPond, you can write

#(define-macro (pattern args result)
   `(define-music-function (parser location ,@args)
      ,(make-list (length args) 'ly:music?)
     (make-sequential-music (map! ly:music-deep-copy (list ,@result)))))

$(pattern (A B C D) (A B D A C D))
  { a' a' a' a' }
  { b' b' b' b' }
  { c'' c'' c'' c'' }
  { d'' d'' d'' d'' }

-- 
David Kastrup


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to