From: David Kastrup Date: Sun, 12 Jul 2015 10:02:44 +0000 (+0200) Subject: Issue 4501/1: Add music-type-predicate function X-Git-Tag: release/2.19.24-1~5^2~18 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=57d515f2b1a03f79b22871add4c1509cd89d810e;p=lilypond.git Issue 4501/1: Add music-type-predicate function This creates a predicate function checking for a set of types. --- diff --git a/scm/music-functions.scm b/scm/music-functions.scm index a952a82846..132f2f2369 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -35,6 +35,14 @@ "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