Previous page Table of Contents Next page
The following elementary classes define the basic data types:
anything the root class number abstract rational abstract integer abstract int32 unboxable big-integer ratio floating-point abstract float unboxable, single precision double unboxable, double precision boolean unboxable, abstract false only one instance true only one instance character unboxable string immutable name abstract simple-name only one instance per spelling name-in-context keyword immutable, only one instance per spelling list fixed-length list (= vector or array) stack variable-length list argument-list rest argument bit-vector fixed-length list of bits dictionary maps key to values type abstract class protocol range consecutive integers type-union
The classes number, rational, integer, ratio, float, and double have constructors that accept a number or a string and convert it to the appropriate type of number. All of these clases are immutable. These classes other than ratio do not have any slots aside from the class slot belonging to all objects.
The class ratio has slots numerator and denominator which are integers. Its constructor can be called with two integer arguments which are the numerator and denominator respectively.
The classes boolean, false, and true are immutable and have no slots and no visible constructors.
The class character is immutable. Its constructor accepts an integer and returns the character with that character code. The slot code contains an integer which is the character's code.
The class name has no slots aside from the class slot belonging to all objects. Its pseudo-constructor accepts a spelling, which is a string or a name, and an optional context, which is false, a name, a module, or a macro-context. All names are immutable.
The class simple-name has a spelling slot, which is a string. Its pseudo-constructor takes a spelling string and returns the simple-name with that spelling (ignoring alphabetic case), creating it if it does not already exist.
The class name-in-context has a name slot, which is a simple-name, and a context slot, which is a macro-context or a module. Its pseudo-constructor takes name and context arguments. The name argument can be a simple-name or a string. The context argument can be false, a name, a module, or a macro-context. A name context means the context property of that name. If the context is false the result is a simple-name rather than a name-in-context.
The class keyword has one slot, name, which is a simple-name with the same spelling as the keyword minus the final colon. Its pseudo-constructor accepts a string or a simple-name. Keywords are interned, i.e. there is only one instance per spelling (ignoring alphabetic case). Keywords are immutable.
The classes list, stack, bit-vector, and dictionary have pseudo-constructors of the same name which accept any number of arguments. The arguments become the initial contents of the constructed object. The real constructors are list#, stack#, bit-vector#, and dictionary# which take one integer argument which is the length of a list or bit-vector or the initial capacity of a stack or dictionary; the length of a stack or dictionary created this way is zero.
The class string has a constructor of the same name which accepts any number of arguments, converts them to strings, and concatenates them together to produce the constructed object. There is no string# since strings are immutable.
The class argument-list is an immutable array with no public slots or constructor.
The class class is explained elsewhere.
The class protocol has only a name slot and a multi-valued super-protocols slot. its constructor takes the corresponding arguments. The name is used to recover an equivalent protocol when doing separate compilation.
The class range is both an immutable array and a type. The elements of the array are the members of the type in numerical order. The constructor's parameter list is (start is number or false, end is number or false, optional: stride is number = 1). A false start or end indicates an open-ended range, e.g. if start is 0, end is false, and stride is 1 the range includes all non-negative integers. Range has slots start, end, length, and stride. Start and end are inclusive.
The class type-union has a multi-valued members slot. The constructor's parameter list is (rest: members is type). This class is immutable.
Previous page Table of Contents Next page