]> git.donarmstrong.com Git - lilypond.git/commitdiff
Implement fraction? predicate checking for pair of unsigned integers
authorDavid Kastrup <dak@gnu.org>
Sun, 30 Oct 2011 06:54:39 +0000 (07:54 +0100)
committerDavid Kastrup <dak@gnu.org>
Tue, 8 Nov 2011 21:56:53 +0000 (22:56 +0100)
scm/c++.scm
scm/lily.scm

index 915e7e62830c07f635abcfc647fa666c57701879..5a5f8e0bad8b31c5b196c5c8e7bf5f8fb3c00d0c 100644 (file)
   (and (pair? x)
        (number? (car x)) (number? (cdr x))))
 
+(define-public (fraction? x)
+  (and (pair? x)
+       (integer? (car x)) (integer? (cdr x))
+       (>= (car x) 0) (>= (cdr x) 0)))
+
 (define-public (number-or-grob? x)
   (or (ly:grob? x) (number? x)))
 
index 3ad7fb580e32542bdb09c1ca818db759c62f9051..4ab0164850ded4ab48134798b265ba724370c66c 100644 (file)
@@ -508,6 +508,7 @@ LilyPond safe mode.  The syntax is the same as `define*-public'."
   `((,boolean-or-symbol? . "boolean or symbol")
     (,color? . "color")
     (,cheap-list? . "list")
+    (,fraction? . "fraction, as pair")
     (,grob-list? . "list of grobs")
     ;; this is built on cheap-list
     (,list-or-symbol? . "list or symbol")