From: David Kastrup Date: Sun, 22 Dec 2013 09:33:31 +0000 (+0100) Subject: Issue 3746: Fix unfold-repeats-fully with alternatives X-Git-Tag: release/2.19.0-1~30 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7db742b0daa87a2476f476aa42dc28c8a532f34d;p=lilypond.git Issue 3746: Fix unfold-repeats-fully with alternatives When fewer alternatives than repeats are given, the _first_ alternative needs to get reused (the previous code wrongly used the last one). --- diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 592cff33c3..c094ebfa40 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -390,19 +390,17 @@ beats to be distinguished." (and (music-is-of-type? m 'unfolded-repeated-music) (make-sequential-music (ly:music-deep-copy - (let loop ((n (ly:music-property m 'repeat-count)) - (alts (ly:music-property m 'elements)) - (body (ly:music-property m 'element))) + (let ((n (ly:music-property m 'repeat-count)) + (alts (ly:music-property m 'elements)) + (body (ly:music-property m 'element))) (cond ((<= n 0) '()) - ((null? alts) - (cons body (loop (1- n) alts body))) + ((null? alts) (make-list n body)) (else - (cons* body (car alts) - (loop (1- n) - (if (pair? (cdr alts)) - (cdr alts) - alts) - body))))))))) + (concatenate + (zip (make-list n body) + (append! (make-list (max 0 (- n (length alts))) + (car alts)) + alts)))))))))) (unfold-repeats music))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;