Expressions, Types, and Functions |
There are other kinds of data than lists and numbers. In this chapter we will - relatively briefly - review booleans, characters, symbols, vectors, and strings in Scheme.
7.1 Other simple types | 7.3 Strings |
7.2 Vectors |
7.1. Other simple types
Contents Up Previous Next Slide Subject index Program index Exercise index
As most other programming languages Scheme supports the simple types of booleans and characters. As a slightly more specialized type, Scheme also supports symbols.
You can get the details of these data types by reading in the Scheme Report [Abelson98]. Section 6.3.1 in the report covers the boolean type. Section 6.3.4 is about characters. Symbols are described in section 6.3.3. From the slide and the annotated slide view of this material, there are direct links to these sections of the Scheme Report.
Besides numbers, Scheme also supports booleans, characters, and symbols |
|
The equivalence function eqv? is similar to eq?. See section 6.1 of [Abelson98] for details.
7.2. Vectors
Contents Up Previous Next Slide Subject index Program index Exercise index
There are a number of superficial similarities between vectors and list, as supported by Scheme. However, at the conceptual level vectors are arrays, and lists are linearly linked structures. As such, they represent quite different structures.
The most basic and fundamental difference between lists and vectors is that lists can be changed and extended in a very flexible way (due to the use of dynamically allocated cons cells). A vector is of fixed and constant size once allocated.
Vectors are treated in section 6.3.6 of [Abelson98].
Vectors in Scheme are heterogeneous array-like data structures of a fixed size |
|
The main difference between lists and vectors is the mode of access and the mode of construction |
7.3. Strings
Contents Up Previous Next Slide Subject index Program index Exercise index
There are no big surprises in the way Scheme handles and supports strings. Please see section 6.3.5 of [Abelson98] for details.
String is an array-like data structure of fixed size with elements of type character. |
|
Like lists, strings are important for many practical purposes, and it is therefore important to familiarize yourself with the
string functions in Scheme |
7.4. References
[Abelson98] | Richard Kelsey, William Clinger and Jonathan Rees, "Revised^5 Report on the Algorithmic Language Scheme", Higher-Order and Symbolic Computation, Vol. 11, No. 1, August 1998, pp. 7--105. |