A.23 Tipi di predicati predefiniti

Predicates return #t when their argument is of the named type and #f if it isn’t.


R5RS primary predicates

Primary predicates can be applied to any expression. They can be used on their own as predicates for LilyPond functions. The predicates here are part of the Scheme standard R5RS.

Type predicateDescription
boolean?boolean
char?character
complex?complex number
eof-object?end-of-file object
input-port?input port
integer?integer
list?list (use cheap-list? for faster processing)
null?null
number?number
output-port?output port
pair?pair
port?port
procedure?procedure
rational?rational number
real?real number
string?string
symbol?symbol
vector?vector

R5RS secondary predicates

Secondary predicates are only applicable to specific expressions (for example, to numbers). They will throw a type error when applied to expressions they are not intended for. The predicates here are part of the Scheme standard R5RS.

Type predicateDescription
char-alphabetic?alphabetic character
char-lower-case?lower-case character
char-numeric?numeric character
char-upper-case?upper-case character
char-whitespace?whitespace character
even?even number
exact?exact number
inexact?inexact number
negative?negative number
odd?odd number
positive?positive number
zero?zero

Guile predicates

These predicates are defined by Guile but are not part of a Scheme standard.

Type predicateDescription
hash-table?hash table

LilyPond scheme predicates

These predicates are only available within LilyPond and defined in Scheme.

Type predicateDescription
alist?association list (list of pairs)
boolean-or-symbol?boolean or symbol
cheap-list?list (use this instead of list? for faster processing)
color?color
exact-rational?an exact rational number
fraction?fraction, as pair
grob-list?list of grobs
index?non-negative, exact integer
index-or-markup?index or markup
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
ly:skyline-pair?pair of skylines
markup?markup
markup-command-list?markup command list
markup-list?markup list
moment-pair?pair of moment objects
number-list?number list
number-or-grob?number or grob
number-or-pair?number or pair
number-or-string?number or string
number-pair?pair of numbers
number-pair-list?list of number pairs
rational-or-procedure?an exact rational or procedure
rhythmic-location?rhythmic location
scale?non-negative rational, fraction, or moment
scheme?any type
string-or-music?string or music
string-or-pair?string or pair
string-or-symbol?string or symbol
symbol-key-alist?alist, with symbols as keys
symbol-list?symbol list
symbol-list-or-music?symbol list or music
symbol-list-or-symbol?symbol list or symbol
void?void

LilyPond exported predicates

These predicates are only available within LilyPond and usually defined in C++.

Type predicateDescription
ly:book?book
ly:context?context
ly:context-def?context definition
ly:context-mod?context modification
ly:dimension?dimension, in staff space
ly:dir?direction
ly:dispatcher?dispatcher
ly:duration?duration
ly:event?post event
ly:font-metric?font metric
ly:grob?graphical (layout) object
ly:grob-array?array of grobs
ly:grob-properties?grob properties
ly:input-location?input location
ly:item?item
ly:iterator?iterator
ly:lily-lexer?lily-lexer
ly:lily-parser?lily-parser
ly:listener?listener
ly:moment?moment
ly:music?music
ly:music-function?music function
ly:music-list?list of music objects
ly:music-output?music output
ly:otf-font?OpenType font
ly:output-def?output definition
ly:page-marker?page marker
ly:pango-font?Pango font
ly:paper-book?paper book
ly:paper-system?paper-system Prob
ly:pitch?pitch
ly:prob?property object
ly:score?score
ly:skyline?skyline
ly:source-file?source file
ly:spanner?spanner
ly:spring?spring
ly:stencil?stencil
ly:stream-event?stream event
ly:transform?coordinate transform
ly:translator?translator
ly:translator-group?translator group
ly:unpure-pure-container?unpure/pure container

LilyPond — Guida alla Notazione v2.23.82 (ramo di sviluppo).