3.7 Keywords
A keyword value is similar to a symbol (see Symbols), but its printed form is prefixed with #:.
Reading Keywords in The Racket Reference documents the fine points of the syntax of keywords.
Examples: | ||||||
|
More precisely, a keyword is analogous to an identifier; in the same way that an identifier can be quoted to produce a symbol, a keyword can be quoted to produce a value. The same term “keyword” is used in both cases, but we sometimes use keyword value to refer more specifically to the result of a quote-keyword expression or of string->keyword. An unquoted keyword is not an expression, just as an unquoted identifier does not produce a symbol:
Examples: | |||||
|
Despite their similarities, keywords are used in a different way than identifiers or symbols. Keywords are intended for use (unquoted) as special markers in argument lists and in certain syntactic forms. For run-time flags and enumerations, use symbols instead of keywords. The example below illustrates the distinct roles of keywords and symbols.
Examples: | ||||||||
|