Keywords
The defined name of this module is keyword
.
keyword
:
syntax
The syntax of keywords is very similar to that for identifiers and for symbols,
including all the escape conventions. Keywords are distinguished by a colon
(:
) suffix. 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 keywordss 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
.
<keyword>
:
class
The class of all instance of <keyword>.
Initialization options
- string : string
- The string containing the
characters to be used to name the keyword. The default value for string
is the empty string, thus resulting in the keyword with no name, written
|:|
.
What is the defined behaviour if the last character of string is
colon?
keywordp
:
function
Arguments
- object
- Object to examine.
Result
Returns object if it is a keyword.
keyword-name
:
function
Arguments
- keyword
- A keyword.
Result
Returns a string which is equal
to that given as the argument to the call to make
which
created keyword. It is an error to modify this string.
keyword-exists-p
:
function
Arguments
- string
- A string containing the characters to be used to
determine the existence of a keyword with that name.
Result
Returns the keyword whose name is string if that
keyword has already been constructed by make
. Otherwise,
returns ().
generic-prin
:
method
Specialized arguments
- (keyword <keyword>)
- The
keyword to be output on stream.
- (stream <stream>)
- The
stream on which the representation is to be output.
Result
The keyword supplied as the first argument.
Remarks
Outputs the external representation of keyword
on stream as described in the section on symbols, interpreting each
of the characters in the name.
generic-write
:
method
Specialized arguments
- (keyword <keyword>)
- The
keyword to be output on stream.
- (stream <stream>)
- The
stream on which the representation is to be output.
Result
The keyword supplied as the first argument.
Remarks
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.
Examples
- input:
-
(write (make
<keyword> 'string "abc"))
- output:
-
abc:
- input:
-
(write (make
<keyword> 'string "a c"))
- output:
-
|a c:|
- input:
-
(write (make
<keyword> 'string ").("))
- output:
-
|).(:|
(converter
<string>)
: class
Specialized arguments
- (keyword <keyword>)
- A
keyword to be converted to a string.
Result
A string.
Remarks
This function is the same as
keyword-name
. It is defined for the sake of symmetry.