]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/music-functions.scm
Issue 4501/1: Add music-type-predicate function
[lilypond.git] / scm / music-functions.scm
index a952a8284649d78dfa71e19522111d55e2139b51..132f2f236947c4b9395a37df53255556d7b0ed33 100644 (file)
   "Does @code{mus} belong to the music class @code{type}?"
   (memq type (ly:music-property mus 'types)))
 
+(define-safe-public (music-type-predicate types)
+  "Returns a predicate function that can be used for checking
+music to have one of the types listed in @var{types}."
+   (if (cheap-list? types)
+       (lambda (m)
+         (any (lambda (t) (music-is-of-type? m t)) types))
+       (lambda (m) (music-is-of-type? m types))))
+
 ;; TODO move this
 (define-public ly:grob-property
   (make-procedure-with-setter ly:grob-property