A key (previously a symbol) can be either a non-negative
integer (obeying the predicate index?) or a symbol. When used for
overrides/reverts, the first elements of a path may not actually be
numbers but they are flagged as an error by other means: since a full
override path can be the concatenation of several key lists, the leading
elements are not treated differently by the list predicates.
Strictly speaking this should not be the case for key-list-or-music? or
key-list-or-symbol? predicates, but making them behave differently seems
unwarranted. Arguably key-list-or-symbol? should possibly be
key-list-or-key? instead.
(define-public (boolean-or-symbol? x)
(or (boolean? x) (symbol? x)))
+(define-public (key? x)
+ (or (symbol? x) (index? x)))
+
+(define-public (key-list? x)
+ (and (list? x) (every key? x)))
+
+(define-public (key-list-or-music? x)
+ (if (list? x)
+ (every key? x)
+ (ly:music? x)))
+
+(define-public (key-list-or-symbol? x)
+ (if (list? x)
+ (every key? x)
+ (symbol? x)))
+
(define-public (symbol-list? x)
(and (list? x) (every symbol? x)))
(,fraction? . "fraction, as pair")
(,grob-list? . "list of grobs")
(,index? . "non-negative integer")
+ (,key? . "index or symbol")
+ (,key-list? . "list of indexes or symbols")
+ (,key-list-or-music? . "key list or music")
+ (,key-list-or-symbol? . "key list or symbol")
(,markup? . "markup")
(,markup-command-list? . "markup command list")
(,markup-list? . "markup list")