This section describes the classes required at level-0 and the operations defined on instances of those classes. The section is organized by module in alphabetical order. These sub-sections contain information about the predefined classes in EULISP that are necessary to make the language usable.
Character literals are denoted by the extension glyph, called hash (#), followed by the character-extension glyph, called reverse solidus (\), followed by the name of the character. The syntax for the external representation of characters is defined in syntax table 16.1.1.1. For most characters, their name is the same as the glyph associated with the character, for example: the character “a” has the name “a” and has the external representation #\a. Certain characters in the group named special (see table 9.1 and also syntax table 16.1.1.1) form the syntax category special-character-token and are referred to using the digrams defined in table 16.1.1.
Operation | Digram |
alert | \a |
backspace | \b |
delete | \d |
formfeed | \f |
linefeed | \l |
newline | \n |
return | \r |
tab | \t |
vertical tab | \v |
hex-insertion | \x |
string delimiter | \" |
string escape | \\ |
Any character which does not have an external representation dealt with by cases described so far is represented by the digram #\x (see table 16.1.1) followed four hexadecimal digits. The value of the hexadecimal number represents the position of the character in the current character set. Examples of such character literals are #\x0000 and #\xabcd, which denote, respectively, the characters at position 0 and at position 43981 in the character set current at the time of reading or writing. The syntax for the external representation of characters is defined in syntax table 16.1.1.1 below:
character: |
literal-character-token |
special-character-token |
numeric-character-token |
literal-character-token: |
#\letter |
#\decimal-digit |
#\other-character |
#\special-character |
special-character-token: |
#\\a |
#\\b |
#\\d |
#\\f |
#\\l |
#\\n |
#\\r |
#\\t |
#\\v |
#\\" |
#\\\ |
numeric-character-token: |
#\\x hexadecimal-digit hexadecimal-digit |
hexadecimal-digit hexadecimal-digit |
The class of all characters.
Object to examine.
Returns object if it is a character, otherwise ().
A character.
A character.
If character1 is the same character as character2 the result is character1, otherwise the result is ().
A character.
A character.
If both characters denote uppercase alphabetic or both denote lowercase alphabetic, the result is defined by alphabetical order. If both characters denote a digit, the result is defined by numerical order. In these three cases, if the comparison is t, the result is character1, otherwise it is (). Any other comparison is an error and the result of such comparisons is undefined.
(binary< #\A #\Z) | ⇒ | #\A |
(binary< #\a #\z) | ⇒ | #\a |
(binary< #\0 #\9) | ⇒ | #\0 |
(binary< #\A #\a) | ⇒ | undefined |
(binary< #\A #\0) | ⇒ | undefined |
(binary< #\a #\0) | ⇒ | undefined |
Method binary< <string> for
.
An object to convert to lower case.
An instance of the same class as object converted to lower case according to the actions of the appropriate method for the class of object.
Another method as-lowercase <string> for <string>.
A character.
If character denotes an upper case character, a character denoting its lower case counterpart is returned. Otherwise the result is the argument.
An object to convert to upper case.
An instance of the same class as object converted to upper case according to the actions of the appropriate method for the class of object.
Another method is defined on as-uppercase <string> for <string>.
A character.
If character denotes an lower case character, a character denoting its upper case counterpart is returned. Otherwise the result is the argument.
Character to be ouptut on stream.
Stream on which character is to be ouptut.
The character character.
Output the interpretation of character on stream.
Character to be ouptut on stream.
Stream on which character is to be ouptut.
The character character.
Output external representation of character on stream in the format #\name as described at the beginning of this section.
When iterating over a single collection, the order in which elements are processed might not be important, but as soon as more than one collection is involved, it is necessary to specify how the collections are aligned so that it is clear which elements of the collections will be processed together. This is quite straightforward in the cases of <list>, <string> and <vector>, since there is an intuitive natural order for the elements which allows them to be identified by a non-negative integer. Thus, when iterating over a combination of any of these, all the elements at index position i will be processed together, starting with the elements at position 0 and finishing with those at position n - 1 where n is the size of the smallest collection in the combination. The subset of collections which have natural order is called sequence and members of this set can be identified by the predicate sequence?, while collections in general can be identified by collection?.
Collection alignment is more complicated when tables are involved since they use explicit keys rather than natural order to identify their elements. In any iteration over a combination of collections including a table or some tables, the set of keys used is the intersection of the keys of the tables and the implicit keys of the other collection classes present; this identifies the elements of the collections with common keys. Thus, for an iteration to process any elements from the combination of a collection with natural order and a table, the table must have some integer keys and they must be in the range [0…size) of the collection with natural order.
A conforming level-0 implementation must define methods on these functions to support operations on lists (16.12), strings (16.16), tables (16.18), vector (16.19) and any combination of these.
The class of all collections.
The class of all sequences, the subset of collections which have natural order.
The class of all sequences of characters e.g. <string>.
This is the condition class for all collection processing conditions.
A function of two arguments.
The object which is the initial value for the accumulation operation.
The collection which is the subject of the accumulation operation.
The result is the result of the application of function to the accumulated result and successive elements of collection. The initial value of the accumulated result is supplied by obj.
Note that the order of the elements in the result of the second example depends on the hashing algorithm of the implementation and does not prescribe the result that any particular implementation must give.
(accumulate * 1 #(1 2 3 4 5)) | ⇒ | 120 | |||||||||||||||
| ⇒ | (c b a) | |||||||||||||||
A function of two arguments.
The collection which is the subject of the accumulation operation.
The result is the result of the application of function to the accumulated result and successive elements of collection starting with the second element. The initial value of the accumulated result is the first element of collection. The terms first and second correspond to the appropriate elements of a natural order collection, but no elements in particular of an explicit key collection. If collection is empty, the result is ().
| ⇒ | (4 2) | ||||||||||
A function to be used as a predicate on the elements of the collection(s).
A collection.
More collections.
The function is applied to argument lists constructed from corresponding successive elements of collection and more-collections. If the result is t for all elements of collection and more-collections the result of all? is t otherwise ().
any?.
A function to be used as a predicate on the elements of the collection(s).
A collection.
More collections.
The function is applied to argument lists constructed from corresponding successive elements of collection and more-collections. If the result is t, the result of any? is t and there are no further applications of function to elements of collection and more-collections. If any of the collections is exhausted, the result of any? is ().
(any? even? #(1 2 3 4)) | ⇒ | t | ||||||
| ⇒ | () | ||||||
| ⇒ | t |
all?.
An object to examine.
Returns t if object is a collection, otherwise ().
This predicate does not return object because () is a collection.
A collection.
More collections.
The result is an object of the same class as collection.
The contents of the result object depend on whether collection has natural order or not:
(concatenate #(1) ’(2) "bc") | ⇒ | #(1 2 #\b #\c)) | |||||||||
(concatenate "a" ’(#\b)) | ⇒ | "ab" | |||||||||
| ⇒ |
#<table:
0 -> "c", 1 -> b>
|
Object to be removed.
A collection.
The function to be used to compare object—/ and the elements of collection.
If there is an element of collection such that test returns t when applied to object—/ and that element, then the result is the modified collection, less that element. Otherwise, the result is collection.
delete is destructive. The test function defaults to eql.
A function.
A collection.
More collections.
The result is (). This operator is used for side-effect only. The function is applied to argument lists constructed from corresponding successive elements of collection and more-collections and the result is discarded. Application stops if any of the collections is exhausted.
(do prin ’(1 b #\c)) | ⇒ | 1bc |
(do write ’(1 b #\c)) | ⇒ | 1b#\c |
The object to be accessed or updated.
The object identifying the key of the element in collection.
The value associated with key in collection.
(element "abc" 1) | ⇒ | #\b | |||||||
(element ’(a b c) 1) | ⇒ | b | |||||||
(element #(a b c) 1) | ⇒ | b | |||||||
| ⇒ | b | |||||||
The object to be accessed or updated.
The object identifying the key of the element in collection.
The object to replace the value associated with key in collection (for setter).
The argument supplied as value, having updated the association of key in collection to refer to value.
The object to be examined.
Returns t if collection is the object identified with the empty object for that class of collection.
A collection to be (partially) filled.
The object with which to fill collection.
The keys with which object is to be associated.
The result is ().
This function side-effects collection by updating the values associated with each of the specified keys with obj. If no keys are specified, the whole collection is filled with obj. Otherwise, the key specification can take two forms:
A collection.
A function.
An integer.
An integer.
The function test is applied to successive elements of collection. If test returns t when applied to an element, then the result of find-key is the key associated with that element.
The value skip, which defaults to zero, indicates how many successful tests are to be made before returning a result. The value failure, which defaults to (), is returned if no key satisfying the test was found. Note that skip and failure are positional arguments and that skip must be specified if failure is specified.
A sequence.
The result is contents of index position 0 of sequence.
A sequence.
The result is last element of sequence.
A collection.
The result is a collection comprising the keys of collection.
A function.
A collection.
More collections.
The result is an object of the same class as collection. The elements of the result are computed by the application of function to argument lists constructed from corresponding successive elements of collection and more-collections. Application stops if any of the collections is exhausted.
(map cons #(1 2) ’(3)) | ⇒ | #((1 . 3)) | ||||||
| ⇒ | #(3 -1 2 1) |
The object to be searched for in collection.
The collection to be searched.
The function to be used to compare object and the elements of collection.
Returns t if there is an element of collection such that the result of the application of test to object and that element is t. If test is not supplied, eql is used by default. Note that t denotes any value that is not () and that the class of the result depends on the class of collection. In particular, if collection is a list, the result of member is a list.
(member #\b "abc") | ⇒ | t | |||||||||||||
(member ’b ’(a b c)) | ⇒ | (b c) | |||||||||||||
(member ’b #(a b c)) | ⇒ | t | |||||||||||||
| ⇒ | t | |||||||||||||
Object to be removed.
A collection.
The function to be used to compare object and the elements of collection.
If there is an element of collection such that test returns t when applied to object and that element, then the result is a shallow copy of collection less that element. Otherwise, the result is collection.
The test function defaults to eql.
A collection.
The result is an object of the same class as collection whose elements are the same as those in collection, but in the reverse order with respect to the natural order of collection. If collection does not have natural order, the result is equal to the argument.
(reverse "abc") | ⇒ | "cba" |
(reverse ’(1 2 3)) | ⇒ | (3 2 1) |
(reverse #(a b c)) | ⇒ | #(c b a) |
A collection.
Destructively reverses the order of the elements in collection (see reverse) and returns it.
An object to examine.
Returns t if object is a sequence (has natural order), otherwise ().
This predicate does not return object because () is a sequence.
The object to be examined.
An integer which denotes the size of collection according to the method for the class of collection.
(size "") | ⇒ | 0 |
(size ()) | ⇒ | 0 |
(size #()) | ⇒ | 0 |
(size (make <table>)) | ⇒ | 0 |
(size "abc") | ⇒ | 3 |
(size (cons 1 ())) | ⇒ | 1 |
(size (cons 1 . 2)) | ⇒ | 1 |
(size (cons 1 (cons 2 . 3))) | ⇒ | 2 |
(size ’(1 2 3)) | ⇒ | 3 |
(size #(a b c)) | ⇒ | 3 |
(size (make <table> ’entries ’((0 . a))) | ⇒ | 1 |
A sequence.
The index of the first element of the slice.
The index of the last element of the slice.
The result is new sequence of the same class as sequence containing the elements of sequence from start up to but not including end.
(slice ’(a b c d) 1 3) | ⇒ | (b c) |
A sequence.
A function.
The result of sort is a new sequence comprising the elements of sequence ordered according to comparator.
Methods on this function are only defined for <list> and <vector>.
A sequence.
A function.
Destructively sorts the elements of sequence (see sort) and returns it.
Methods on this function are only defined for <list> and <vector>.
A collection to be converted into a list.
If collection is a list, the result is the argument. Otherwise a list is constructed and returned whose elements are the elements of collection. If collection has natural order, then the elements will appear in the result in the same order as in collection. If collection does not have natural order, the order in the resulting list is undefined.
Conversion (16.4).
A collection to be converted into a string.
If collection is a string, the result is the argument. Otherwise a string is constructed and returned whose elements are the elements of collection as long as all the elements of collection are characters. An error is signalled (condition class: conversion-condition) if any element of collection is not a character. If collection has natural order, then the elements will appear in the result in the same order as in collection. If collection does not have natural order, the order in the resulting string is undefined.
Conversion (16.4).
A collection to be converted into a table.
If collection is a table, the result is the argument. Otherwise a table is constructed and returned whose elements are the elements of collection. If collection has natural order, then the elements will be stored under integer keys in the range [0…size), otherwise the keys used will be the keys associated with the elements of collection.
Conversion (16.4).
A collection to be converted into a vector.
If collection is a vector, the result is the argument. Otherwise a vector is constructed and returned whose elements are the elements of collection. If collection has natural order, then the elements will appear in the result in the same order as in collection. If collection does not have natural order, the order in the resulting vector is undefined.
Conversion (16.4).
(eq a b) | ⇒ | (eql a b) | ⇒ | (binary= a b) |
(eq a b) | ⁄⇐ | (eql a b) | ⁄⇐ | (binary= a b) |
There are four n-ary function for comparing objects by order, < and > which are implemented by the generic function binary<, <= and >= which are implemented by the generic functions binary< and binary=. There is also one binary function for comparing objects for inequality, !=. A summary of the comparison functions and the classes for which they have defined behaviour is given below:
An object.
An object.
Compares object1 and object2 and returns t if they are the same object, otherwise (). Same in this context means “identifies the same memory location”.
In the case of numbers and characters the behaviour of eq might differ between processors because of implementation choices about internal representations. Therefore, eq might return t or () for numbers which are = and similarly for characters which are eql, depending on the implementation .
(eq ’a ’a) | ⇒ | t |
(eq ’a ’b) | ⇒ | () |
(eq #\a #\a) | ⇒ | t or () |
(eq 3 3) | ⇒ | t or () |
(eq 3 3.0) | ⇒ | () |
(eq 3.0 3.0) | ⇒ | t or () |
(eq (cons ’a ’b) (cons ’a ’c)) | ⇒ | () |
(eq (cons ’a ’b) (cons ’a ’b)) | ⇒ | () |
(eq ’(a . b) ’(a . b)) | ⇒ | t or () |
(let ((x (cons ’a ’b))) (eq x x)) | ⇒ | t |
(let ((x ’(a . b))) (eq x x)) | ⇒ | t |
(eq "string" "string") | ⇒ | t or () |
(eq #(’a ’b) #(’a ’b)) | ⇒ | t or () |
(let ((x #(’a ’b))) (eq x x)) | ⇒ | t |
An object.
An object.
If the class of object1 and of object2 is the same and is a subclass of <character> or <number>, the result is that of comparing them under binary= <character> or binary= <number> respectively. Otherwise the result is that of comparing them under eq.
Given the same set of examples as for eq, the same result is obtained except in the following cases:
(eql #\a #\a) | ⇒ | t |
(eql 3 3) | ⇒ | t |
(eql 3.0 3.0) | ⇒ | t |
An object.
An object.
Returns t or () according to the method for the class(es) of object1 and object2. It is an error if either or both of the arguments is self-referential.
Class specific methods on binary= are defined for <character>, <list>, <number> (with specialisations for <fpi> and <double-float>), <string>, ??. All other cases are handled by the default method defined for <object>:
An object.
An object.
The result is as if eql had been called with the arguments supplied.
An object.
An object.
The first argument if it is less than the second, according to the method for the class of the arguments, otherwise ().
Class specific methods on binary< are defined for <character>, <string>, <fpi> and <double-float>.
A non-empty sequence of numbers.
Given one argument the result is t. Given more than one argument the result is determined by binary=, returning t if all the arguments are the same, otherwise ().
A non-empty sequence of numbers.
Given one argument the result is (). Given more than one argument the result is determined by binary=, returning () if all the arguments are the same, otherwise t.
A non-empty sequence of objects.
Given one argument the result is t. Given more than one argument the result is t if the sequence of objects object1 up to objectn is strictly increasing according to the generic function binary<. Otherwise, the result is ().
A non-empty sequence of objects.
Given one argument the result is t. Given more than one argument the result is t if the sequence of objects object1 up to objectn is strictly decreasing according to the generic function binary< applied to the arguments in reverse order. Otherwise, the result is ().
A non-empty sequence of objects.
Given one argument the result is t. Given more than one argument the result is t if the sequence of objects object1 up to objectn is strictly increasing according to the generic function binary< and binary=. Otherwise, the result is ().
A non-empty sequence of objects.
Given one argument the result is t. Given more than one argument the result is t if the sequence of objects object1 up to objectn is strictly decreasing according to the generic function binary< and binary= applied to the arguments in reverse order. Otherwise, the result is ().
A non-empty sequence of objects.
The maximal element of the sequence of objects object1 up to objectn using the generic function binary<. Zero arguments is an error. One argument returns object1.
A non-empty sequence of objects.
The minimal element of the sequence of objects object1 up to objectn using the generic function binary<. Zero arguments is an error. One argument returns object1.
The mechanism for the conversion of an instance of one class to an instance of another is defined by a user-extensible framework which has some similarity to the setter mechanism.
To the user, the interface to conversion is via the function convert, which takes an object and some class to which the object is to be converted. The target class is used to access an associated converter function, in fact, a generic function, which is applied to the source instance, dispatching on its class to select the method which implements the appropriate conversion. Thus, having defined a new class to which it may be desirable to convert instances of other classes, the programmer defines a generic function:
Hereafter, new converter methods may be defined for new-class using a similar extended syntax for defmethod:
The conversion is implemented by defining methods on the converter for new-class which specialize on the source class. This is also how methods are documented in this text: by an entry for a method on the converter function for the target class. In general, the method for a given source class is defined in the section about that class, for example, converters from one kind of collection to another are defined in section 16.2, converters from string in section 16.16, etc..
An instance of some class to be converted to an instance of class.
The class to which object is to be converted.
Returns an instance of class which is equivalent in some class-specific sense to object, which may be an instance of any type. Calls the converter function associated with class to carry out the conversion operation. An error is signalled (condition: <no-converter> ) if there is no associated function. An error is signalled (condition: <no-applicable-method> ) if there is no method to convert an instance of the class of object to an instance of class.
This is the general condition class for all conditions arising from conversion operations.
Should be signalled by convert or a converter method.
Should be signalled by convert if there is no associated function.
The class whose set of conversion methods is required.
The accessor returns the converter function for the class target-class. The converter is a generic-function with methods specialized on the class of the object to be converted.
The class whose converter function is to be replaced.
The new converter function.
The new converter function. The setter function replaces the converter function for the class target-class by generic-function. The new converter function must be an instance of <generic-function>.
Converter methods from one class to another are defined in the section pertaining to the source class.
Converter methods are defined for collections (16.2), double float (16.6), fixed precision integer (16.9), string (16.16), symbol (16.17), vector (16.19).
An object to be copied.
Constructs and returns a copy of the source which is the same (under some class specific predicate) as the source and whose slots contain copies of the objects stored in the corresponding slots of the source, and so on. The exact behaviour for each class of object is defined by the most applicable method for object.
Class specific sections which define methods on deep-copy: list (16.12), string (16.16), table (16.18) and vector (16.19).
An object.
Returns object.
A class.
Constructs and returns a new structure whose slots are initialized with copies (using deep-copy) of the contents of the slots of class.
An object to be copied.
Constructs and returns a copy of the source which is the same (under some class specific predicate) as the source. The exact behaviour for each class of object is defined by the most applicable method for object.
Class specific sections which define methods on shallow-copy: pair (16.12), string (16.16), table (16.18) and vector (16.19).
An object.
Returns object.
A class.
Constructs and returns a new structure whose slots are initialized with the contents of the correpsonding slots of struct.
The defined name of this module is double. Arithmetic operations for <double-float> are defined by methods on the generic functions defined in the compare module (16.3):
the number module (16.14):
the float module (16.7):
and the elementary functions module (??):
The behaviour of these functions is defined in the modules noted above.
The class of all double precision floating point numbers.
The syntax for the exponent of a double precision floating point is given below:
The general syntax for floating point numbers is given in syntax table 16.7.1.1.
Object to examine.
Returns object if it is a double float, otherwise ().
The value of most-positive-double-float is that positive double precision floating point number closest in value to (but not equal to) positive infinity that the processor provides.
The value of least-positive-double-float is that positive double precision floating point number closest in value to (but not equal to) zero that the processor provides.
The value of least-negative-double-float is that negative double precision floating point number closest in value to (but not equal to) zero that the processor provides. Even if the processor provide negative zero, this value must not be negative zero.
The value of most-negative-double-float is that negative double precision floating point number closest in value to (but not equal to) negative infinity that the processor provides.
A double precision float.
Constructs and returns a string, the characters of which correspond to the external representation of x as produced by generic-print, namely that specified in the syntax as [sign]float format 3.
A double precision float.
A fixed precision integer.
This function is the same as the <double-float> method of round. It is defined for the sake of symmetry.
The double float to be output on stream.
The stream on which the representation is to be output.
The double float supplied as the first argument.
Outputs the external representation of double on stream, as an optional sign preceding the syntax defined by float format 3. Finer control over the format of the output of floating point numbers is provided by some of the formatting specifications of format (see section 16.8).
The double float to be output on stream.
The stream on which the representation is to be output.
The double float supplied as the first argument.
Outputs the external representation of double on stream, as an optional sign preceding the syntax defined by float format 3. Finer control over the format of the output of floating point numbers is provided by some of the formatting specifications of format (see section 16.8).
The syntax for the external representation of floating point literals is defined in syntax table 16.7.1.1. The representation used by write and ?? is that of a sign, a whole part and a fractional part without an exponent, namely that defined by float format 3. Finer control over the format of the output of floating point numbers is provided by some of the formatting specifications of format (section 16.8).
float: |
signopt unsigned-float exponentopt |
unsigned-float: |
float-format-1 |
float-format-2 |
float-format-3 |
float-format-1: |
decimal-integer . |
float-format-2: |
. decimal-integer |
float-format-3: |
float-format-1 decimal-integer |
exponent: |
double-exponent |
A floating point number has six forms of external representation depending on whether either or both the whole and the fractional part are specified and on whether an exponent is specified. In addition, a positive floating point number is optionally preceded by a plus sign and a negative floating point number is preceded by a minus sign. For example: +123. (float format 1), -.456 (float format 2), 123.456 (float format 3); and with exponents: +123456.D-3, 1.23455D2, -.123456D3.
The abstract class which is the superclass of all floating point numbers.
Object to examine.
Returns object if it is a floating point number, otherwise ().
A floating point number.
Returns the smallest integral value not less than float expressed as a float of the same class as the argument.
A floating point number.
Returns the largest integral value not greater than float expressed as a float of the same class as the argument.
A floating point number.
Returns the integer whose value is closest to float, except in the case when float is exactly half-way between two integers, when it is rounded to the one that is even.
A floating point number.
Returns the greatest integer value whose magnitude is less than or equal to float.
A string containing format directives.
A stream from which input is to be taken.
Returns a list of the objects read from stream.
This function provides support for formatted input. The format-string specifies reading directives, and inputs are matched according to these directives. An error is signaled (condition: <scan-mismatch>) if the class of the object read is not compatible with the specified directive. The second (optional) argument specifies a stream from which to take input. If stream is not supplied, input is taken from stdin. Scan returns a list of the objects read in.
This condition is signalled by scan if the format string does not match the data input from stream.
A stream.
A string containing format directives.
A sequence of objects to be output on stream.
Returns stream and has the side-effect of outputting objects according the formats specified in format-string to stream. Characters are output as if the string were output by the ?? function with the exception of those prefixed by tilde—graphic representation ~—which are treated specially as detailed in the following list. These formatting directives are intentionally compatible with the facilities defined for the function fprintf in ISO/IEC 9899 : 1990 except for the prefix ~ rather than %.
A string containing format directives.
A sequence of objects to be output on stdout.
Returns stdout and has the side-effect of outputting objects according the formats specified in format-string (see sformat) to stdout.
A string containing format directives.
A sequence of objects to be formatted into a string.
Return the string created by formatting the objects according the formats specified in format-string (see sformat).
the number module:
and in the integer module:
The behaviour of these functions is defined in the modules noted above.
The class of all instances of fixed precision integers.
Object to examine.
Returns object if it is fixed precision integer, otherwise ().
This is an implementation-defined constant. A conforming processor must support a value greater than or equal to 32767 and greater than or equal to the value of maximum-vector-index.
This is an implementation-defined constant. A conforming processor must support a value less than or equal to -32768.
An integer.
Constructs and returns a string, the characters of which correspond to the external representation of integer in decimal notation.
An integer.
Returns a double float whose value is the floating point approximation to integer.
An integer to be output on stream.
The stream on which the representation is to be output.
The fixed precision integer supplied as the first argument.
Outputs external representation of integer on stream in decimal as defined by decimal integer at the beginning of this section.
An integer to be output on stream.
The stream on which the representation is to be output.
The fixed precision integer supplied as the first argument.
Outputs external representation of integer on stream in decimal as defined by decimal integer at the beginning of this section.
A positive integer is has its external representation as a sequence of digits optionally preceded by a plus sign. A negative integer is written as a sequence of digits preceded by a minus sign. For example, 1234567890, -456, +1959.
Integer literals have an external representation in any base up to base 36. For convenience, base 2, base 8 and base 16 have distinguished notations—#b, #o and #x, respectively. For example: 1234, #b10011010010, #o2322 and #x4d2 all denote the same value.
The general notation for an arbitrary base is #baser, where base is an unsigned decimal number. Thus, the above examples may also be written: #10r1234, #2r10011010010, #8r2322, #16r4d2 or #36rya. The reading of any number is terminated on encountering a character which cannot be a constituent of that number. The syntax for the external representation of integer literals is defined below.
integer: |
signopt unsigned-integer |
sign: one of |
+ - |
unsigned-integer: |
binary-integer |
octal-integer |
decimal-integer |
hexadecimal-integer |
specified-base-integer |
binary-integer: |
#b binary-digit+ |
binary-digit: one of |
0 1 |
octal-integer: |
#o octal-digit+ |
octal-digit: one of |
0 1 2 3 4 5 6 7 |
decimal-integer: |
decimal-digit+ |
hexadecimal-integer: |
#x hexadecimal-digit+ |
hexadecimal-digit: |
decimal-digit |
hex-lower-letter |
hex-upper-letter |
hex-lower-letter: one of |
a b c d e f |
hex-upper-letter: one of |
A B C D E F |
specified-base-integer: |
# base-specification r |
specified-base-digit |
specified-base-digit* |
base-specification: |
{ 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 } |
{ 1 | 2 } decimal-digit |
3 { 0 | 1 | 2 | 3 | 4 | 5 | 6 } |
specified-base-digit: |
decimal-digit |
letter |
The abstract class which is the superclass of all integer numbers.
Object to examine.
Returns object if it is an integer, otherwise ().
An integer.
Returns t if two divides integer, otherwise ().
An integer.
Returns the equivalent of the logical negation of even? applied to integer.
The syntax of keywords is very similar to that of identifiers and of symbols, including all the escape conventions, but are distinguished by a colon (:) suffix:
keyword: |
identifier: |
It is an error to use a keyword where an identifier is expected, such as, for example, in lambda parameter lists or in let binding forms.
The matter of keywords appering in lambda parameter lists, for example, rest:, instead of the dot notation, is currently an open issue.
Operationally, the most important aspect of keywords is that each is unique, or, stated the other way around: the result of processing every syntactic token comprising the same sequence of characters which denote a keyword is the same object. Or, more briefly, every keyword with the same name denotes the same keyword. A consequence of this guarantee is that keywords may be compared using eq.
The class of all instance of <keyword>.
What is the defined behaviour if the last character of string is colon?
Object to examine.
Returns object if it is a keyword.
A keyword.
Returns a string which is binary= <string> to that given as the argument to the call to make which created keyword. It is an error to modify this string.
A string containing the characters to be used to determine the existence of a keyword with that name.
Returns the keyword whose name is string if that keyword has already been constructed by make. Otherwise, returns ().
The keyword to be output on stream.
The stream on which the representation is to be output.
The keyword supplied as the first argument.
Outputs the external representation of keyword on stream as described in the section on symbols, interpreting each of the characters in the name.
The keyword to be output on stream.
The stream on which the representation is to be output.
The keyword supplied as the first argument.
Outputs the external representation of keyword on stream as described in the section on symbols. If any characters in the name would not normally be legal constituents of a keyword, the output is preceded and succeeded by multiple-escape characters.
(write (make <keyword> ’string "abc")) | ⇒ | abc: |
(write (make <keyword> ’string "a c")) | ⇒ | |a c:| |
(write (make <keyword> ’string ").(")) | ⇒ | |).(:| |
A keyword to be converted to a string.
A string.
This function is the same as keyword-name. It is defined for the sake of symmetry.
The class of all lists.
The empty list, which is the only instance of the class <null>, has as its external representation an open parenthesis followed by a close parenthesis. The empty list is also used to denote the boolean value false.
The class whose only instance is the empty list, denoted ().
Object to examine.
Returns t if object is the empty list, otherwise ().
The empty list.
The stream on which the representation is to be output.
The empty list.
Output the external representation of the empty list on stream as described above.
The empty list.
The stream on which the representation is to be output.
The empty list.
Output the external representation of the empty list on stream as described above.
A pair is written as (object1 . object2), where object1 is called the car and object2 is called the cdr. There are two special cases in the external representation of pair. If object2 is the empty list, then the pair is written as (object1). If object2 is an instance of pair, then the pair is written as (object1 object3 . object4), where object3 is the car of object2 and object4 is the cdr with the above rule for the empty list applying. By induction, a list of length n is written as (object1 …objectn-1 . objectn), with the above rule for the empty list applying. The representations of object1 and object2 are determined by the external representations defined in other sections of this definition (see <character> (16.1), <double-float> (16.6), <fpi> (16.9), <string> (16.16), <symbol> (16.17) and <vector> (16.19), as well as instances of <cons> itself. The syntax for the external representation of pairs and lists is defined in syntax table 16.12.7.1.
null: |
() |
pair: |
( object . object ) |
list: |
empty-list |
proper-list |
improper-list |
empty-list: |
() |
proper-list: |
( object+ ) |
improper-list: |
( object+ . object ) |
() | the empty list |
(1) | a list whose car is 1 and cdr is () |
(1 . 2) | a pair whose car is 1 and cdr is 2 |
(1 2) | a list whose car is 1 and cdr is (2) |
The class of all instances of <cons>. An instance of the class <cons> (also known informally as a dotted pair or a pair) is a 2-tuple, whose slots are called, for historical reasons, car and cdr. Pairs are created by the function cons and the slots are accessed by the functions car and cdr. The major use of pairs is in the construction of (proper) lists. A (proper) list is defined as either the empty list (denoted by ()) or a pair whose cdr is a proper list. An improper list is one containing a cdr which is not a list (see syntax table 16.12.7.1).
It is an error to apply car or cdr or their setter functions to anything other than a pair. The empty list is not a pair and (car ()) or (cdr ()) is an error.
Object to examine.
Returns object if it is a pair, otherwise ().
Object to examine.
Returns object if it is not a pair, otherwise ().
An object. pair.
An object. pair.
Allocates a new pair whose slots are initialized with object1 in the car and object2 in the cdr.
A pair.
Given a pair, such as the result of (cons object1 object2), then the function car returns object1.
A pair.
Given a pair, such as the result of (cons object1 object2), then the function cdr returns object2.
A pair.
An object.
Given a pair, such as the result of (cons object1 object2), then the function (setter car) replaces object1 with object. The result is object.
A pair.
An object.
Given a pair, such as the result of (cons object1 object2), thenthe function (setter cdr) replaces object2 with object. The result is object.
Note that if object is not a proper list, then the use of (setter cdr) might change pair into an improper list.
A pair.
A pair.
If the result of the conjunction of the pairwise application of binary= to the car fields and the cdr fields of the arguments is t the result is pair1 otherwise the result is ().
A pair.
Constructs and returns a copy of the list starting at pair copying both the car and the cdr slots of the list. The list can be proper or improper. Treatment of the objects stored in the car slot (and the cdr slot in the case of the final pair of an improper list) is determined by the deep-copy method for the class of the object.
A pair.
Constructs and returns a copy of the list starting at pair but copying only the cdr slots of the list, terminating when a pair is encountered whose cdr slot is not a pair. The list beginning at pair can be proper or improper.
A sequence of objects.
Allocates a set of pairs each of which has been initialized with objecti in the car field and the pair whose car field contains objecti+1 in the cdr field. Returns the pair whose car field contains object1.
(list) | ⇒ | () |
(list 1 2 3) | ⇒ | (1 2 3) |
The pair to be output on stream.
The stream on which the representation is to be output.
The pair supplied as the first argument.
Output the external representation of pair on stream as described at the beginning of this section. Uses generic-print to produce the external representation of the contents of the car and cdr slots of pair.
The pair to be output on stream.
The stream on which the representation is to be output.
The pair supplied as the first argument.
Output the external representation of pair on stream as described at the beginning of this section. Uses generic-write to produce the external representation of the contents of the car and cdr slots of pair.
The value of pi is the ratio the circumference of a circle to its diameter stored to double precision floating point accuracy.
A floating point number.
Computes the principal value of the arc cosine of float which is a value in the range [0,π] radians. An error is signalled (condition-class: <domain-condition>) if float is not in the range [-1, +1].
A floating point number.
Computes the principal value of the arc sine of float which is a value in the range [-π∕2, +π∕2] radians. An error is signalled (condition-class: <domain-condition>) if float is not in the range [-1, +1].
A floating point number.
Computes the principal value of the arc tangent of float which is a value in the range [-π∕2, +π∕2] radians.
A floating point number.
A floating point number.
Computes the principal value of the arc tangent of float1/float2, which is a value in the range [-π, +π] radians, using the signs of both arguments to determine the quadrant of the result. An error might be signalled (condition-class: <domain-condition>) if either float1 or float2 is zero.
A floating point number.
Computes the cosine of float (measured in radians).
A floating point number.
Computes the sine of float (measured in radians).
A floating point number.
Computes the tangent of float (measured in radians).
A floating point number.
Computes the hyperbolic cosine of float. An error might be signalled (condition class: <range-condition>) if the magnitude of float is too large.
A floating point number.
Computes the hyperbolic sine of float. An error might be signalled (condition class: <range-condition>) if the magnitude of float is too large.
A floating point number.
Computes the hyperbolic tangent of float.
A floating point number.
Computes the exponential function of float. An error might be signalled (condition class: <range-condition>) if the magnitude of float is too large.
A floating point number.
Computes the natural logarithm of float. An error is signalled (condition class: <domain-condition>) if float is negative. An error might be signalled (condition class: <range-condition>) if float is zero.
A floating point number.
Computes the base-ten logarithm of float. An error is signalled (condition class: <domain-condition>) if float is negative. An error might be signalled (condition class: <range-condition>) if float is zero.
A floating point number.
A floating point number.
Computes float1 raised to the power float2. An error is signalled (condition class: <domain-condition>) if float1 is negative and float2 is not integral. An error is signalled (condition class: <domain-condition>) if the result cannot be represented when float1 is zero and float2 is less than or equal to zero. An error might be signalled (condition class: <range-condition>) if the result cannot be represented.
A floating point number.
Computes the non-negative square root of float. An error is signalled (condition class: <domain-condition>) if float is negative.
Numbers can take on many forms with unusual properties, specialized for different tasks, but two classes of number suffice for the majority of needs, namely integers (<integer>, <fpi>) and floating point numbers (<float>, <double-float>). Thus, these only are defined at level-0.
Table 4 shows the initial number class hierarchy at level-0. The inheritance relationships by this diagram are part of this definition, but it is not defined whether they are direct or not. For example, <integer> and <float> are not necessarily direct subclasses of <number>, while the class of each number class might be a subclass of <number>. Since there are only two concrete number classes at level-0, coercion is simple, namely from <fpi> to <double-float>. Any level-0 version of a library module, for example, elementary-functions ??, need only define methods for these two classes. Mathematically, the reals are regarded as a superset of the integers and for the purposes of this definition we regard <float> as a superset of <integer> (even though this will cause representation problems when variable precision integers are introduced). Hence, <float> is referred to as being higher that <integer> and arithmetic involving instances of both classes will cause integers to be converted to an equivalent floating point value, before the calculation proceeds 3 3 (see in particular binary/, binary% and binary-mod).
<num | ber> |
<flo | at> |
<double-float> |
<integer> |
<fpi> |
The abstract class which is the superclass of all number classes.
Object to examine.
Returns object if it is a number, otherwise ().
This is the general condition class for conditions arising from arithmetic operations.
Signalled by any of binary/, binary% and binary-mod if their second argument is zero.
A sequence of numbers.
Computes the sum of the arguments using the generic function binary+. Given zero arguments, + returns 0 of class <integer>. One argument returns that argument. The arguments are combined left-associatively.
A non-empty sequence of numbers.
Computes the result of subtracting successive arguments—from the second to the last—from the first using the generic function binary-. Zero arguments is an error. One argument returns the negation of the argument, using the generic function negate. The arguments are combined left-associatively.
A sequence of numbers.
Computes the product of the arguments using the generic function binary*. Given zero arguments, * returns 1 of class <integer>. One argument returns that argument. The arguments are combined left-associatively.
A non-empty sequence of numbers.
Computes the result of dividing the first argument by its succeeding arguments using the generic function binary/. Zero arguments is an error. One argument computes the reciprocal of the argument. It is an error in the single argument case, if the argument is zero.
A non-empty sequence of numbers.
Computes the result of taking the remainder of dividing the first argument by its succeeding arguments using the generic function binary%. Zero arguments is an error. One argument returns that argument.
A non-empty sequence of numbers.
Computes the largest integral value not greater than the result of dividing the first argument by its succeeding arguments using the generic function binary-mod. Zero arguments is an error. One argument returns number1.
A non-empty sequence of numbers.
Computes the greatest common divisor of number1 up to numbern using the generic function binary-gcd. Zero arguments is an error. One argument returns number1.
A non-empty sequence of numbers.
Computes the least common multiple of number1 up to numbern using the generic function binary-lcm. Zero arguments is an error. One argument returns number1.
A number.
Computes the absolute value of number.
A number.
Compares number with the zero element of the class of number using the generic function binary=.
A number.
Computes the additive inverse of number.
A number.
Returns number if zero? applied to number is t. Otherwise returns the result of converting ±1 to the class of number with the sign of number.
A number.
Compares number against the zero element of the class of number using the generic function binary<.
A number.
Compares number against the zero element of the class of number using the generic function binary<.
A number.
A number.
Returns t if number1 and number2 are numerically equal otherwise ();
A number.
A number.
Computes the sum of number1 and number2.
A number.
A number.
Computes the difference of number1 and number2.
A number.
A number.
Computes the product of number1 and number2.
A number.
A number.
Computes the division of number1 by number2 expressed as a number of the class of the higher of the classes of the two arguments. The sign of the result is positive if the signs the arguments are the same. If the signs are different, the sign of the result is negative. If the second argument is zero, the result might be zero or an error might be signalled (condition class: <division-by-zero>).
A number.
A number.
Computes the value of number1-i*number2 expressed as a number of the class of the higher of the classes of the two arguments, for some integer i such that, if number2 is non-zero, the result has the same sign as number1 and magnitude less then the magnitude of number2. If the second argument is zero, the result might be zero or an error might be signalled (condition class: <division-by-zero>).
A number.
A number.
Computes the largest integral value not greater than number1 number2 expressed as a number of the class of the higher of the classes of the two arguments, such that if number2 is non-zero, the result has the same sign as number2 and magnitude less than number2. If the second argument is zero, the result might be zero or an error might be signalled (condition class: <division-by-zero>).
A number.
A number.
Computes the greatest common divisor of number1 and number2.
A number.
A number.
Computes the lowest common multiple of number1 and number2.
The aim of the stream design presented here is an open architecture for programming with streams, which should be applicable when the interface to some object can be characterized by either serial access to, or delivery of, objects.
The two specific objectives are: (i) transfer of objects between a process and disk storage; (ii) transfer of objects between one process and another.
The fundamental purpose of a stream object in the scheme presented here is to provide an interface between two objects through the two functions read, for streams from which objects are received, and write, for streams to which objects are sent.
This is the root of the stream class hierarchy and also defines the basic stream class.
The following accessor functions are defined for <stream>
stream-lock : A lock, to be used to allow exclusive access to a stream. stream-source : An object to which the stream is connected and from which input is read. stream-sink : An object to which the stream is connected and to which ouptut is written. stream-buffer : An object which is used to buffer data by some subclasses of <stream>. Its default value is (). stream-buffer-size : The maximum number of objects that can be stored in stream-buffer. Its default value is 0.
The transaction unit of <stream> is <object>.
The object to be examined.
Returns object if it is a stream, otherwise ().
A constructor function of one argument for <stream> which returns a stream whose stream-read-action is the given argument.
A constructor function of one argument for <stream> which returns a stream whose stream-write-action is the given argument.
This class specializes <stream> by the use of a buffer which may grow arbitrarily large. The transaction unit of <buffered-stream> is <object>.
This class specializes <buffered-stream> by placing a bound on the growth of the buffer. The transaction unit of <fixed-buffered-stream> is <object>.
This class specializes <fixed-buffered-stream> by providing an interface to data stored in files on disk. The transaction unit of <file-stream> is <character>. The following additional accessor functions are defined for <file-stream>: file-stream-filename : The path identifying the file system object associated with the stream. file-stream-mode : The mode of the connection between the stream and the file system object (usually either read or write). file-stream-buffer-position : A key identifying the current position in the stream’s buffer.
The object to be examined.
Returns object if it is a <file-stream> otherwise ().
The class of the default string stream.
The object to be examined.
Returns object if it is a <string-stream> otherwise ().
The source object from which the stream will read data.
The sink object to which the stream will write data.
An optional argument for specifying implementation-defined options.
The return value is ().
Connects source to sink according to the class-specific behaviours of generic-connect.
The source object from which the stream will read data.
The sink object to which the stream will write data.
An optional argument for specifying implementation-defined options.
Generic form of connect.
The stream which is to be the source of sink.
The stream which is to be the sink of source.
A list of implementation-defined options.
The return value is ().
Connects the source of sink to source and the sink of source to sink.
A path name.
The stream via which data will be received from the file named by path.
A list of implementation-defined options.
The return value is ().
Opens the object identified by the path source for reading and connects sink to it. Hereafter, sink may be used for reading data from sink, until sink is disconnected or reconnected. Implementation-defined options for the opening of files may be specified using the third argument.
The stream via which data will be sent to the file named by path.
A path name.
A list of implementation-defined options.
The return value is ().
Opens the object identifed by the path sink for writing and connects source to it. Hereafter, source may be used for writing data to sink, until source is disconnected or reconnected. Implementation-defined options for the opening of files may be specified using the third argument.
A stream.
A stream.
The return value is ().
Transfers the source and sink connections of s1 to s2, leaving s1 disconnected.
A stream.
A stream.
The return value is ().
Implements the reconnect operation for objects of class <stream>.
A stream.
The return value is ().
Disconnects the stream s from its source and/or its sink.
A stream.
The return value is ().
Implements the diconnect operation for objects of class <stream>.
A file stream.
The return value is ().
Implements the diconnect operation for objects of class <file-stream>. In particular, this involves closing the file associated with the stream s.
The standard input stream, which is a file-stream and whose transaction unit is therefore character. In Posix compliant configurations, this object is initialized from the Posix stdin object. Note that although stdin itself is a constant binding, it may be connected to different files by the reconnect operation.
The standard lisp input stream, and its transaction unit is object. This stream is initially connected to stdin (although not necessarily directly), thus a read operation on lispin will case characters to be read from stdin and construct and return an object corresponding to the next lisp expression. Note that although lispin itself is a constant binding, it may be connected to different source streams by the reconnect operation.
The standard output stream, which is a file-stream and whose transaction unit is therefore character. In Posix compliant configurations, this object is initialized from the Posix stdout object. Note that although stdout itself is a constant binding, itmay be connected to different files by the reconnect operation.
The standard error stream, which is a file-stream and whose transaction unit is therefore character. In Posix compliant configurations, this object is initialized from the Posix stderr object. Note that although stderr itself is a constant binding, it may be connected to different files by the reconnect operation.
A stream.
The buffer associated with stream is refilled from its source. Returns a count of the number of items read.
This function is guaranteed to be called when an attempt is made to read from a buffered stream whose buffer is either empty, or from which all the items have been read.
A stream.
A stream.
A stream.
The contents of the buffer associated with stream is flushed to its sink. If this operation succeeds, a t value is returned, otherwise the result is ().
This function is guaranteed to be called when an attempt is made to write to a buffered stream whose buffer is full.
A stream.
The contents of the buffer associated with stream is flushed to its sink. If this operation succeeds, a t value is returned, otherwise the result is ().
Implements the flush-buffer operation for objects of class <buffered-stream>.
A stream.
The contents of the buffer associated with stream is flushed to its sink. If this operation succeeds, a t value is returned, otherwise the result is ().
Implements the flush-buffer operation for objects of <file-stream>. This method is called both when the buffer is full and after a newline character is written to the buffer.
Signalled by the default end of stream action, as a consequence of a read operation on stream, when it is at end of stream.
A stream.
This function is guaranteed to be called when a read operation encounters the end of stream and the eos-error? argument to read has a non-() value.
A stream.
Signals the end of stream condition.
A stream.
Disconnects stream and signals the end of stream condition.
A stream.
Signalled by a read operation which fails in some manner other than when it is at end of stream.
A stream.
A boolean.
Value to be returned to indicate end of stream.
That of calling generic-read with the arguments supplied or defaulted as described.
The stream defaults to lispin, eos-error? defaults to () and eos-value defaults to eos-default-value.
A stream.
A boolean.
Value to be returned to indicate end of stream.
The next transaction unit from stream.
If the end of stream is encountered and the value of eos-error? is (), the result is eos-value. If the end of stream is encountered and the value of eos-error? is non-(), the function ?? is called with the argument stream.
A stream.
A boolean.
Value to be returned to indicate end of stream.
That of calling the read-action of stream with the arguments stream, eos-error? and eos-value. Returns t.
Implements the generic-read operation for objects of class <stream>.
A buffered stream.
A boolean.
Value to be returned to indicate end of stream.
The next object stored in the stream buffer. If the buffer is empty, the function fill-buffer is called. If the refilling operation did not succeed, the end of stream action is carried out as described under generic-read. Returns t.
Implements the generic-read operation for objects of class <buffered-stream>.
A file stream.
A boolean.
Value to be returned to indicate end of stream.
The next object stored in the stream buffer. If the buffer is empty, the function fill-buffer is called. If the refilling operation did not succeed, the end of stream action is carried out as described under generic-read. Returns t.
Implements the generic-read operation for objects of class <file-stream>.
An object to be written to stream.
Stream to which object is to be written.
Returns object.
Outputs the external representation of object on the output stream stream.
The following generic-write methods are defined: generic-write <character>, generic-write <symbol>, generic-write <keyword>, generic-write <fpi>, generic-write <double-float>, generic-write <null>, generic-write <cons>, ??, generic-write <string>, generic-write <vector>, generic-write <stream>, generic-write <buffered-stream> and generic-write <file-stream>.
An object to be written to stream.
Stream to which object is to be written.
An object to be written to stream.
Stream to which object is to be written.
An object to be written to stream.
Stream to which object is to be written.
Stream to which object is to be written.
An object to be written to stream.
Returns stream.
Outputs the external representation of object on the output stream stream using generic-write.
An object to be written to stream.
Returns stdout.
Outputs the external representation of object on stdout using generic-write.
A stream.
A boolean.
Value to be returned to indicate end of stream.
A string.
Reads a line (terminated by a newline character or the end of the stream) from the stream of characters which is stream. Returns the line as a string, discarding the terminating newline, if any. If the stream is already at end of stream, then the stream action is called: the default stream action is to signal an error: (condition class: <end-of-stream>).
An object to be output on stream.
A character stream on which object is to be output.
Returns object.
Outputs the external representation of object on the output stream stream.
??. The following generic-write methods are defined: generic-write <character>, generic-write <symbol>, generic-write <keyword>, generic-write <fpi>, generic-write <double-float>, generic-write <null>, generic-write <cons>, ??, generic-write <string> and generic-write <vector>.
A character stream on which object is to be output.
A sequence of objects to be output on stream.
Returns stream.
Outputs the external representation of object1 object2 ... on the output stream stream using generic-print for each object.
A sequence of objects to be output on stdout.
Returns stdout.
Outputs the external representation of object1 object2 ... on the output stream stdout using ?? for each object.
sprint and generic-print.
A stream to flush.
Returns stream.
sflush causes any buffered data for the stream to be written to the stream. The stream remains open.
Returns stdout.
flush causes any buffered data for stdout to be written to stdout.
A stream.
Character to be written to stream.
Integer count.
Outputs char on stream. The optional count times defaults to 1.
Character to be written to stdout.
Integer count.
Outputs char on stdout. The optional count times defaults to 1.
A stream.
A boolean.
Value to be returned to indicate end of stream.
A path identifying a file system object.
Allocates and returns a new <file-stream> object whose source is connected to the file system object identified by path.
A path identifying a file system object.
Allocates and returns a new <file-stream> object whose sink is connected to the file system object identified by path.
String literals are delimited by the glyph called quotation mark ("). For example, "abcd".
Sometimes it might be desirable to include string delimiter characters in strings. The aim of escaping in strings is to fulfill this need. The string-escape glyph is defined as reverse solidus (\). String escaping can also be used to include certain other characters that would otherwise be difficult to denote. The set of named special characters (see § 9.1 and § 16.1) are included in strings using the character digrams defined in table 16.1.1. To allow arbitrary characters to appear in strings, the hex-insertion digram is followed by an integer denoting the position of the character in the current character set as for characters (see § 9.1). The syntax for the external representation of strings is defined in syntax table 16.16.1.1 below:
string: |
" string-constituent* " |
string-constituent: |
normal-string-constituent |
digram-string-constituent |
?? |
normal-string-constituent: |
level-0-character other than " or \ |
digram-string-constituent: one of |
\a \b \d \f \l \n \r \t \v \" \\ |
numeric-string-constituent: |
\x hexadecimal-digit |
\x hexadecimal-digit hexadecimal-digit |
\x hexadecimal-digit hexadecimal-digit |
hexadecimal-digit |
\x hexadecimal-digit hexadecimal-digit |
hexadecimal-digit hexadecimal-digit |
Some examples of string literals appear in table 1.
Example | Contents |
"a\nb" | #\a, #\n and #\b |
"c\\" | #\c and #\\ |
"\x1 " | #\x1 followed by #\space |
"\xabcde" | #\xabcd followed by #\e |
"\x1\x2" | #\x1 followed by #\x2 |
"\x12+" | #\x12 followed by #\+ |
"\xabcg" | #\xabc followed by #\g |
"\x00abc" | #\xab followed by #\c |
The function write outputs a re-readable form of any escaped characters in the string. For example, "a\n\\b" (input notation) is the string containing the characters #\n, #\a, #\\ and #\b. The function write produces "a\n\\b", whilst ?? produces
The function write outputs characters which do not have a glyph associated with their position in the character set as a hex insertion in which all four hex digits are specified, even if there are leading zeros, as in the last example in table 1. The function ?? outputs the interpretation of the characters according to the definitions in section 16.1 without the delimiting quotation marks.
The class of all instances of <string>.
(make <string>) | ⇒ | "" |
(make <string> size: 2) | ⇒ | "\x0000\x0000" |
(make <string> size: 3 | ⇒ | "aaa" |
fill-value: #\a) | ||
Object to examine.
Returns object if it is a string, otherwise ().
A string to be converted to a symbol.
If the result of symbol-exists? when applied to string is a symbol, that symbol is returned. If the result is (), then a new symbol is constructed whose name is string. This new symbol is returned.
A string.
A string.
If the size of string1 is the same (under =) as that of string2, and the result of the conjunction of the pairwise application of binary= <character> to the elements of the arguments is t the result is string1. If not the result is ().
A string.
Constructs and returns a copy of string in which each element is eql to the corresponding element in string.
A string.
Constructs and returns a copy of string in which each element is eql to the corresponding element in string.
A string.
A string.
If the second argument is longer than the first, the result is (). Otherwise, if the sequence of characters in string1 is pairwise less than that in string2 according to binary< <character> the result is t. Otherwise the result is (). Since it is an error to compare lower case, upper case and digit characters with any other kind than themselves, so it is an error to compare two strings which require such comparisons and the results are undefined.
(< "a" "b") | ⇒ | t |
(< "b" "a") | ⇒ | () |
(< "a" "a") | ⇒ | () |
(< "a" "ab") | ⇒ | t |
(< "ab" "a") | ⇒ | () |
(< "A" "B") | ⇒ | t |
(< "0" "1") | ⇒ | t |
(< "a1" "a2") | ⇒ | t |
(< "a1" "bb") | ⇒ | t |
(< "a1" "ab") | ⇒ | undefined |
Method binary< <character> (16.3) for characters (16.1).
A string.
Returns a copy of string in which each character denoting an upper case character, is replaced by a character denoting its lower case counterpart. The result must not be eq to string.
A string.
Returns a copy of string in which each character denoting an lower case character, is replaced by a character denoting its upper case counterpart. The result must not be eq to string.
String to be ouptut on stream.
Stream on which string is to be ouptut.
The string string. Output external representation of string on stream as described in the introduction to this section, interpreting each of the characters in the string. The opening and closing quotation marks are not output.
String to be ouptut on stream.
Stream on which string is to be ouptut.
The string string. Output external representation of string on stream as described in the introduction to this section, replacing single characters with escape sequences if necessary. Opening and closing quotation marks are output.
A symbol is a literal identifier and hence has the same syntax 9.3.0.3:
Because there are two escaping mechanisms and because the first character of a token affects the interpretation of the remainder, there are many ways in which to input the same identifier. If this same identifier is used as a literal, i.e. a symbol, the results of processing each token denoting the identifier will be eq to one another. For example, the following tokens all denote the same symbol:
|123|, \123, |1|23, ||123, ||||123
which will be output by the function write as |123|. If output by write, the representation of the symbol will permit reconstruction by read—escape characters are preserved—so that equivalence is maintained between read and write for symbols. For example: |a(b| and abc.def are two symbols as output by write such that read can read them as two symbols. If output by ??, the escapes necessary to re-read the symbol will not be included. Thus, taking the same examples, ?? outputs a(b and abc.def, which read interprets as the symbol a followed by the start of a list, the symbol b and the symbol abc.def.
Computationally, the most important aspect of symbols is that each is unique, or, stated the other way around: the result of processing every syntactic token comprising the same sequence of characters which denote an identifier is the same object. Or, more briefly, every identifier with the same name denotes the same symbol.
The class of all instances of <symbol>.
Object to examine.
Returns object if it is a symbol.
A string contain characters to be prepended to the name of the new symbol.
Makes a new symbol whose name, by default, begins with the character #\g and the remaining characters are generated by an implementation-defined mechanism. Optionally, an alternative prefix string for the name may be specified. It is guaranteed that the resulting symbol did not exist before the call to gensym.
A symbol.
Returns a string which is binary= <string> to that given as the argument to the call to make which created symbol. It is an error to modify this string.
A string containing the characters to be used to determine the existence of a symbol with that name.
Returns the symbol whose name is string if that symbol has already been constructed by make. Otherwise, returns ().
The symbol to be output on stream.
The stream on which the representation is to be output.
The symbol supplied as the first argument.
Outputs the external representation of symbol on stream as described in the introduction to this section, interpreting each of the characters in the name.
The symbol to be output on stream.
The stream on which the representation is to be output.
The symbol supplied as the first argument.
Outputs the external representation of symbol on stream as described in the introduction to this section. If any characters in the name would not normally be legal constituents of an identifier or symbol, the output is preceded and succeeded by multiple-escape characters.
(write (make <symbol> ’string "abc")) | ⇒ | abc |
(write (make <symbol> ’string "a c")) | ⇒ | |a c| |
(write (make <symbol> ’string ").(")) | ⇒ | |).(| |
A symbol to be converted to a string.
A string.
This function is the same as symbol-name. It is defined for the sake of symmetry.
The class of all instances of <table>.
Object to examine.
Returns object if it is a table, otherwise ().
A table.
An empty table.
All entries in table are deleted. The result is eq to the argument, which is to say that the argument is modified.
Place holder for <hash-table> class.
A vector is written as #(obj1 …objn). For example: #(1 2 3) is a vector of three elements, the integers 1, 2 and 3. The representations of obji are determined by the external representations defined in other sections of this definition (see <character> (16.1), <fpi> (16.9), <float> (16.7), <list> (16.12), <string> (16.16) and <symbol> (16.17), as well as instances of <vector> itself. The syntax for the external representation of vectors is defined below.
vector: |
#( object* ) |
The class of all instances of <vector>.
(make <vector>) | ⇒ | #() |
(make <vector> size: 2) | ⇒ | #(() ()) |
(make <vector> size: 3 | ⇒ | #(#\a #\a #\a) |
fill-value: #\a) | ||
Object to examine.
Returns object if it is a vector, otherwise ().
This is an implementation-defined constant. A conforming processor must support a maximum vector index of at least 32767.
A vector.
A vector.
If the size of vector1 is the same (under =) as that of vector2, and the result of the conjunction of the pairwise application of binary= to the elements of the arguments t the result is vector1. If not the result is ().
A vector.
Constructs and returns a copy of vector, in which each element is the result of calling deep-copy on the corresponding element of vector.
A vector.
Constructs and returns a copy of vector in which each element is eql to the corresponding element in vector.
A vector to be ouptut on stream.
A stream on which the representation is to be output.
The vector supplied as the first argument.
Output the external representation of vector on stream as described in the introduction to this section. Calls the generic function again to produce the external representation of the elements stored in the vector.
A vector to be ouptut on stream.
A stream on which the representation is to be output.
Output the external representation of vector on stream as described in the introduction to this section. Calls the generic function again to produce the external representation of the elements stored in the vector.
object: |
literal |
list | §16.12 |
symbol | §16.17 |
literal: |
boolean |
character | §16.1 |
float | §16.7 |
integer | §16.10 |
string | §16.16 |
vector | §16.19 |
character: |
literal-character-token |
special-character-token |
numeric-character-token |
literal-character-token: |
#\letter |
#\decimal-digit |
#\other-character |
#\special-character |
special-character-token: |
#\\a |
#\\b |
#\\d |
#\\f |
#\\l |
#\\n |
#\\r |
#\\t |
#\\v |
#\\" |
#\\\ |
numeric-character-token: |
#\\x hexadecimal-digit hexadecimal-digit |
hexadecimal-digit hexadecimal-digit |
float: |
signopt unsigned-float exponentopt |
unsigned-float: |
float-format-1 |
float-format-2 |
float-format-3 |
float-format-1: |
decimal-integer . |
float-format-2: |
. decimal-integer |
float-format-3: |
float-format-1 decimal-integer |
exponent: |
double-exponent |
integer: |
signopt unsigned-integer |
sign: one of |
+ - |
unsigned-integer: |
binary-integer |
octal-integer |
decimal-integer |
hexadecimal-integer |
specified-base-integer |
binary-integer: |
#b binary-digit+ |
binary-digit: one of |
0 1 |
octal-integer: |
#o octal-digit+ |
octal-digit: one of |
0 1 2 3 4 5 6 7 |
decimal-integer: |
decimal-digit+ |
hexadecimal-integer: |
#x hexadecimal-digit+ |
hexadecimal-digit: |
decimal-digit |
hex-lower-letter |
hex-upper-letter |
hex-lower-letter: one of |
a b c d e f |
hex-upper-letter: one of |
A B C D E F |
specified-base-integer: |
# base-specification r |
specified-base-digit |
specified-base-digit* |
base-specification: |
{ 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 } |
{ 1 | 2 } decimal-digit |
3 { 0 | 1 | 2 | 3 | 4 | 5 | 6 } |
specified-base-digit: |
decimal-digit |
letter |
null: |
() |
pair: |
( object . object ) |
list: |
empty-list |
proper-list |
improper-list |
empty-list: |
() |
proper-list: |
( object+ ) |
improper-list: |
( object+ . object ) |
string: |
" string-constituent* " |
string-constituent: |
normal-string-constituent |
digram-string-constituent |
?? |
normal-string-constituent: |
level-0-character other than " or \ |
digram-string-constituent: one of |
\a \b \d \f \l \n \r \t \v \" \\ |
numeric-string-constituent: |
\x hexadecimal-digit |
\x hexadecimal-digit hexadecimal-digit |
\x hexadecimal-digit hexadecimal-digit |
hexadecimal-digit |
\x hexadecimal-digit hexadecimal-digit |
hexadecimal-digit hexadecimal-digit |