Scheme provides built-in procedures to test whether values refer
to objects of particular types. If you want to know whether
the value of variable x
is (a pointer to) pair, you can use
the predicate pair?
, like this: (pair? x)
.
Likewise, if you want to know if something is a number, you can
use the predicate number?
. If you want to know whether
a value is an integer, and not just some kind of number, you
can use integer?
.
Several other type predicates are provided, for other data types
we'll discuss later, including string?
, character?
,
vector?
, and port?
.