Basic Types
2010-12-11
Introduction
For all its power, Scheme is a very simple language. It has a few basic data types and operations, which will be discussed here.
Booleans
Booleans are the two values true and false, written as #t
and #f
, respectively. They are typically returned by
predicates (procedures whose names typically end in a question mark) and comparison operators such as =, < and
>=.
Symbols
The symbol is an important data type of Scheme. Symbols are used as identifiers. They can act like names for variables or procedures. However, they can also be used just by themselves; for example, as an option to a procedure.
Characters
Characters are fundamental building blocks, but manipulating them directly is actually quite rare. Still, there are some procedures that do just that, which are discussed in this part.
Strings
Strings are sequences of characters. They are entered into a program between double quotes, e.g. "Hello". Scheme has a few fundamental procedures for manipulating strings, as well as procedures that convert between strings and other types.
Numbers
Numbers are essential for many programs. The Scheme standard defines a rich number system with several classes of number. Although entirely optional, most Scheme implementations support the full number tower: integers, rationals, reals and complex numbers.