Next: Pre-Scheme error handling, Previous: Pre-Scheme bitwise manipulation, Up: Standard Pre-Scheme environment
Pre-Scheme has somewhat lower-level vector & string facilities than
Scheme, with more orientation towards static typing. It also provides
a statically typed record facility, which translates to C structs,
though not described here, as it is not in the prescheme
structure; see Pre-Scheme record types.
Vectors in Pre-Scheme are almost the same as vectors in regular Scheme, but with a few differences.
Make-vector
initializes what it returns with null pointers (see below); it uses the required (unlike Scheme) init argument only to determine the type of the vector: vectors are statically typed; they can contain only values that have the same static type as init.Vector-length
is available only at the top level, where calls to it can be evaluated at compile-time; vectors do not at run-time store their lengths. Vectors must also be explicitly deallocated.Warning: As in C, there is no vector bounds checking at run-time.
Strings in Pre-Scheme are the nearly same as strings in R5RS Scheme. The only three differences here are that
make-string
accepts exactly one argument, strings must be explicitly deallocated, and strings arenul
-terminated:string-length
operates by scanning for the first ASCIInul
character in a string.Warning: As in C, there is no string bounds checking at run-time.