lilypond-user
[Top][All Lists]
Advanced

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

Re: Should \partial accept music instead of duration?


From: David Kastrup
Subject: Re: Should \partial accept music instead of duration?
Date: Sun, 27 Mar 2022 16:23:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Jean Abou Samra <jean@abou-samra.fr> writes:

> Le 26/03/2022 à 03:23, Kieren MacMillan a écrit :
>> Hope that makes it clearer?
>
>
> Yes, I understand better, thanks. I'd just suggest changing your
> snippet to
>
> \version "2.23.7"
>
> $(let ((notes (ly:music-property #{ <e f g a b c' d' e' f' g' a' b' c'
> d'> #} 'elements)))
>     (make-sequential-music
>      (map (lambda (x) (ly:music-deep-copy (list-ref notes (random
> (length notes)))))
>           (iota 400))))
>
>
> with the essential change being the insertion of a
> ly:music-deep-copy so it does not share the same music
> objects for different notes, which could go wrong with
> the application of some music functions.

It doesn't share the same music objects for different notes since $(...)
makes a ly:music-deep-copy anyway that will deduplicate the elements of
SequentialMusic while copying them.  The intermediate expression is
indeed not fit for every use, but the final deep copy fixes that.

-- 
David Kastrup



reply via email to

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