X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fc%2B%2B.scm;h=ded5e9b1209bc0c0be4627db018962d7196eb0f1;hb=007ecffe0dbc2d5dbb033664e6a1e1d2b03756d8;hp=798d7059f6901c9d1db1aeb73e379ff4685634fc;hpb=b7a0cffbf9d1069860368f289a5b50e9d1d90ba8;p=lilypond.git diff --git a/scm/c++.scm b/scm/c++.scm index 798d7059f6..ded5e9b120 100644 --- a/scm/c++.scm +++ b/scm/c++.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 1998--2009 Jan Nieuwenhuizen +;;;; Copyright (C) 1998--2012 Jan Nieuwenhuizen ;;;; Han-Wen Nienhuys ;;;; ;;;; LilyPond is free software: you can redistribute it and/or modify @@ -25,12 +25,22 @@ (and (pair? x) (number? (car x)) (number? (cdr x)))) +(define-public (fraction? x) + (and (pair? x) + (index? (car x)) (index? (cdr x)))) + (define-public (number-or-grob? x) (or (ly:grob? x) (number? x))) (define-public (grob-list? x) (list? x)) +(define-public (number-list? x) + (and (list? x) (every number? x))) + +(define-public (index? x) + (and (integer? x) (>= x 0))) + (define-public (moment-pair? x) (and (pair? x) (ly:moment? (car x)) (ly:moment? (cdr x)))) @@ -47,6 +57,9 @@ (define-public (string-or-pair? x) (or (string? x) (pair? x))) +(define-public (number-or-pair? x) + (or (number? x) (pair? x))) + (define-public (cheap-list? x) (or (pair? x) (null? x))) @@ -55,6 +68,11 @@ (define-public (scheme? x) #t) +(define-public (symbol-or-boolean? x) + (or (symbol? x) (boolean? x))) + +(define-public (void? x) + (unspecified? x)) ;; moved list to end of lily.scm: then all type-predicates are ;; defined. @@ -74,4 +92,8 @@ (type-name (match-predicate obj type-p-name-alist))) (define-public (type-name predicate) - (assoc-get predicate type-p-name-alist "unknown")) + (let ((entry (assoc predicate type-p-name-alist))) + (if (pair? entry) (cdr entry) + (string-trim-right + (symbol->string (procedure-name predicate)) + #\?))))