]> git.donarmstrong.com Git - lilypond.git/commitdiff
Remove music-map-copy and its unnecessary uses. Lilypond copies everything anyway.
authorDavid Kastrup <dak@gnu.org>
Sun, 25 Sep 2011 09:48:01 +0000 (11:48 +0200)
committerDavid Kastrup <dak@gnu.org>
Sun, 25 Sep 2011 09:49:09 +0000 (11:49 +0200)
ly/music-functions-init.ly
scm/music-functions.scm

index e5f46832a75ec7f4e32f4b0f605e491ec8867235..655201c37adae1bb89752d1076e3c9c3f0538e77 100644 (file)
@@ -90,15 +90,13 @@ appendToTag =
    (symbol? ly:music? ly:music?)
    (_i "Append @var{more} to the @code{elements} of all music
 expressions in @var{music} that are tagged with @var{tag}.")
-   (music-map-copy (lambda (m)
-                    (if (memq tag (ly:music-property m 'tags))
-                        (begin
-                          (set! m (music-clone m))
-                          (set! (ly:music-property m 'elements)
-                                (append (ly:music-property m 'elements)
-                                        (list more)))))
-                    m)
-                  music))
+   (music-map (lambda (m)
+               (if (memq tag (ly:music-property m 'tags))
+                   (set! (ly:music-property m 'elements)
+                         (append (ly:music-property m 'elements)
+                                 (list more))))
+               m)
+             music))
 
 applyContext =
 #(define-music-function (parser location proc) (procedure?)
@@ -850,14 +848,12 @@ pushToTag =
    (symbol? ly:music? ly:music?)
    (_i "Add @var{more} to the front of @code{elements} of all music
 expressions in @var{music} that are tagged with @var{tag}.")
-   (music-map-copy (lambda (m)
-                    (if (memq tag (ly:music-property m 'tags))
-                        (begin
-                          (set! m (music-clone m))
-                          (set! (ly:music-property m 'elements)
-                                (cons more (ly:music-property m 'elements)))))
-                    m)
-                  music))
+   (music-map (lambda (m)
+               (if (memq tag (ly:music-property m 'tags))
+                   (set! (ly:music-property m 'elements)
+                         (cons more (ly:music-property m 'elements))))
+               m)
+             music))
 
 quoteDuring =
 #(define-music-function (parser location what main-music) (string? ly:music?)
index de6ec015da5793419df82eaa8332ba9fd10490c0..be4d62e438de36c7a67aba984bfbbbf097eea357 100644 (file)
@@ -66,36 +66,6 @@ First it recurses over the children, then the function is applied to
              (music-map function  e)))
     (function music)))
 
-(define-public (music-map-copy function music)
-  "Apply @var{function} to @var{music} and all of the music it contains.
-
-First it recurses over the children, then the function is applied to
-@var{music}.  This can be used for non-destructive changes when the
-original @var{music} should retain its meaning.  When you change an
-element, return a changed copy.  Then all ancestors will recursively
-become changed copies as well.  The check for change is done via
-@code{eq?}."
-  (let* ((es (ly:music-property music 'elements))
-        (e (ly:music-property music 'element))
-        (esnew (pair-fold-right
-                (lambda (y tail)
-                  (let ((res (music-map-copy function (car y))))
-                    (if (and (eq? (cdr y) tail)
-                             (eq? (car y) res))
-                        y
-                        (cons res tail))))
-                '() es))
-        (enew (if (ly:music? e)
-                  (music-map-copy function e)
-                  e)))
-    (if (not (and (eq? es esnew)
-                 (eq? e enew)))
-       (begin
-         (set! music (music-clone music))
-         (set! (ly:music-property music 'elements) esnew)
-         (set! (ly:music-property music 'element) enew)))
-    (function music)))
-
 (define-public (music-filter pred? music)
   "Filter out music expressions that do not satisfy @var{pred?}."