Star Sapphire Common LISP Home

Download Star Saphire
Index

LISP: KEYWORD

[Typespec][CLTL 4]

SYNOPSIS:

keyword

DESCRIPTION:

This is the type specifier symbol which indicates the set of keyword symbols.

SEE ALSO

keywordp.

LISP: KEYWORDP

C: Lkeywordp

min args: 1

max args: 1

[F][CLTL 10]

SYNOPSIS:

keywordp object

DESCRIPTION:

The predicate keywordp returns t if the argument is a symbol which belongs to the keyword package. Keyword symbols are written with a leading colon. The argument may be any LISP object.

Every keyword is a constant, an object which always evaluates to itself; hence it does not need to be quoted. This makes their use convenient when you want to use a symbol which 'stands for itself', one which is used only for its name. It is an error to try to assign a value to a keyword symbol since it is a constant.

EXAMPLES:

(keywordp :foo) => T ; does not need to be quoted

(keywordp 'foo) => NIL ; symbol needs to be quoted

NOTES:

Note that internally keyword printnames do not have a colon; the colon is an artifact of the package system which indicates that the symbol belongs to the keyword package.

(symbol-name :foo) => "FOO"