Next: scheme overview expressions, Previous: scheme overview overview, Up: scheme overview [Index]
Scheme programs manipulate objects, which are also referred to as values. Scheme objects are organized into sets of values called types. This section gives an overview of the fundamentally important types of the Scheme language. More types are described in later chapters.
NOTE As Scheme is latently typed, the use of the term type in this report differs from the use of the term in the context of other languages, particularly those with manifest typing.
A boolean is a truth value, and can be either true or false. In Scheme,
the object for “false” is written #f
. The object for “true”
is written #t
. In most places where a truth value is expected,
however, any object different from #f
counts as true.
Scheme supports a rich variety of numerical data types, including objects representing integers of arbitrary precision, rational numbers, complex numbers, and inexact numbers of various kinds. Numbers
Scheme characters mostly correspond to textual characters. More precisely, they are isomorphic to the scalar values of the Unicode standard.
Strings are finite sequences of characters with fixed length and thus represent arbitrary Unicode texts.
A symbol is an object representing a string, the symbol’s name. Unlike strings, two symbols whose names are spelled the same way are never distinguishable. Symbols are useful for many applications; for instance, they may be used the way enumerated values are used in other languages.
A pair is a data structure with two components. The most common use of pairs is to represent (singly linked) lists, where the first component (the car) represents the first element of the list, and the second component (the cdr) the rest of the list. Scheme also has a distinguished empty list, which is the last cdr in a chain of pairs that form a list.
Vectors, like lists, are linear data structures representing finite sequences of arbitrary objects. Whereas the elements of a list are accessed sequentially through the chain of pairs representing it, the elements of a vector are addressed by integer indices. Thus, vectors are more appropriate than lists for random access to elements.
Procedures are values in Scheme.
Next: scheme overview expressions, Previous: scheme overview overview, Up: scheme overview [Index]