lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fold out repeats with alternatives


From: David Kastrup
Subject: Re: Fold out repeats with alternatives
Date: Sat, 21 Jul 2012 16:57:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

David Kastrup <address@hidden> writes:

> David Kastrup <address@hidden> writes:
>
>> Johan Vromans <address@hidden> writes:
>>
>>> David Kastrup <address@hidden> 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 #{ address@hidden 
#} ?).

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]