]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4501/2: Use music-type-predicate where useful
authorDavid Kastrup <dak@gnu.org>
Sun, 12 Jul 2015 10:27:42 +0000 (12:27 +0200)
committerDavid Kastrup <dak@gnu.org>
Tue, 21 Jul 2015 06:14:29 +0000 (08:14 +0200)
ly/music-functions-init.ly
scm/define-music-display-methods.scm
scm/music-functions.scm

index 8e6483184f5d7753421b3b5942fc976008986c5e..01169d1e951f4f0dd4c08fee8ff3af14dc4fcfaa 100644 (file)
@@ -1859,10 +1859,10 @@ unsets already in @var{music} cause a warning.  Non-property-related music is ig
      (let
          ((lst
            (fold-some-music
-            (lambda (m) (or (music-is-of-type? m 'layout-instruction-event)
-                            (music-is-of-type? m 'context-specification)
-                            (music-is-of-type? m 'apply-context)
-                            (music-is-of-type? m 'time-signature-music)))
+            (music-type-predicate '(layout-instruction-event
+                                    context-specification
+                                    apply-context
+                                    time-signature-music))
             (lambda (m overrides)
               (case (ly:music-property m 'name)
                 ((OverrideProperty)
index 01eae4bfbbfef9e7128a72af8b4c634115a9138e..c1ee87bbf89b85d552ca5bb39e26fe2d043ae4c2 100644 (file)
@@ -126,8 +126,7 @@ expression."
 ;;; post events
 ;;;
 
-(define (post-event? m)
-  (music-is-of-type? m 'post-event))
+(define post-event? (music-type-predicate 'post-event))
 
 (define* (event-direction->lily-string event #:optional (required #t))
   (let ((direction (ly:music-property event 'direction)))
@@ -418,7 +417,7 @@ Otherwise, return #f."
          (chord-repeat (ly:music-property chord 'duration)))
     (call-with-values
         (lambda ()
-          (partition (lambda (m) (music-is-of-type? m 'rhythmic-event))
+          (partition (music-type-predicate 'rhythmic-event)
                      elements))
       (lambda (chord-elements other-elements)
         (cond ((pair? chord-elements)
index 132f2f236947c4b9395a37df53255556d7b0ed33..304becef0331f593e305add09ae891e1d44ef140 100644 (file)
@@ -747,9 +747,7 @@ duration is replaced with the specified @var{duration}."
   ;; articulations on individual events since they can't actually get
   ;; into a repeat chord given its input syntax.
 
-  (define (keep-element? m)
-    (any (lambda (t) (music-is-of-type? m t))
-         event-types))
+  (define keep-element? (music-type-predicate event-types))
 
   (for-each
    (lambda (field)
@@ -2006,12 +2004,7 @@ not recursing into matches themselves."
   "Return a flat list of all music with @var{type} (either a single
 type symbol or a list of alternatives) inside of @var{music}, not
 recursing into matches themselves."
-  (extract-music
-   music
-   (if (cheap-list? type)
-       (lambda (m)
-         (any (lambda (t) (music-is-of-type? m t)) type))
-       (lambda (m) (music-is-of-type? m type)))))
+  (extract-music music (music-type-predicate type)))
 
 (define*-public (event-chord-wrap! music)
   "Wrap isolated rhythmic events and non-postevent events in