]> git.donarmstrong.com Git - lilypond.git/commitdiff
Simplify interpret-markup-list
authorDavid Kastrup <dak@gnu.org>
Wed, 20 Mar 2013 12:42:59 +0000 (13:42 +0100)
committerDavid Kastrup <dak@gnu.org>
Sat, 6 Apr 2013 06:52:40 +0000 (08:52 +0200)
scm/markup.scm

index a4f723e04c1d6f1162ee881b58f7af0f9acfa3d3..9253c378db998950de8cb4bdb3ee1a56f36575ee 100644 (file)
@@ -48,15 +48,16 @@ Example:
 (define-public interpret-markup ly:text-interface::interpret-markup)
 
 (define-public (interpret-markup-list layout props markup-list)
-  (let ((stencils (list)))
-    (for-each (lambda (m)
-                (set! stencils
-                      (if (markup-command-list? m)
-                          (append! (reverse! (apply (car m) layout props (cdr m)))
-                                   stencils)
-                          (cons (interpret-markup layout props m) stencils))))
-              markup-list)
-    (reverse! stencils)))
+  ;; This relies on the markup list returned by a markup list command
+  ;; to be modifiable
+  (reverse!
+   (fold
+    (lambda (m prev)
+      (if (markup-command-list? m)
+          (reverse! (apply (car m) layout props (cdr m)) prev)
+          (cons (interpret-markup layout props m) prev)))
+    '()
+    markup-list)))
 
 (define-public (prepend-alist-chain key val chain)
   (cons (acons key val (car chain)) (cdr chain)))