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.

— Scheme Procedure: make-keyword-from-dash-symbol symbol
— C Function: scm_make_keyword_from_dash_symbol (symbol)

Return a keyword object from symbol that starts with ‘-’ (a dash).

— Scheme Procedure: keyword? obj
— C Function: scm_keyword_p (obj)

Return #t if obj is a keyword, else #f.

— Scheme Procedure: keyword-dash-symbol keyword
— C Function: scm_keyword_dash_symbol (keyword)

Return keyword as a dash symbol. This is the inverse of make-keyword-from-dash-symbol.