Node:Keyword Primitives, Previous:Keyword Procedures, Up:Keywords



21.7.5 Keyword Primitives

Internally, a keyword is implemented as something like a tagged symbol, where the tag identifies the keyword as being self-evaluating, and the symbol, known as the keyword's dash symbol has the same name as the keyword name but prefixed by a single dash. For example, the keyword #:name has the corresponding dash symbol -name.

Most keyword objects are constructed automatically by the reader when it reads a token beginning with #:. However, if you need to construct a keyword object programmatically, you can do so by calling make-keyword-from-dash-symbol with the corresponding dash symbol (as the reader does). The dash symbol for a keyword object can be retrieved using the keyword-dash-symbol procedure.

make-keyword-from-dash-symbol symbol Scheme Procedure
scm_make_keyword_from_dash_symbol (symbol) C Function
Make a keyword object from a symbol that starts with a dash.

keyword? obj Scheme Procedure
scm_keyword_p (obj) C Function
Return #t if the argument obj is a keyword, else #f.

keyword-dash-symbol keyword Scheme Procedure
scm_keyword_dash_symbol (keyword) C Function
Return the dash symbol for keyword. This is the inverse of make-keyword-from-dash-symbol.