Next: , Previous: , Up: iklib   [Index]


6.23 Keyword objects

Keyword objects are struct instances embedding a Scheme symbol; keyword objects are a disjoint type; keyword objects are not interned.

Keyword objects can be compared with eq?, eqv? and equal?; a keyword object is eq? only to itself. Keyword objects can also be compared with the keyword=? predicate which is faster than eqv? and equal? and slower than eq? for symbols.

The reader supports a special syntax to read keyword objects, Miscellaneous additional syntaxes.

The following bindings are exported by the library (vicare).

Function: symbol->keyword symbol
Function: keyword->symbol keyword

Convert between a symbol and a keyword.

Function: keyword->string keyword

Return the string representation of a keyword.

(keyword->string #:ciao)        ⇒ "#:ciao"
Function: string->keyword string

Build a new keyword object having string as name.

(string->keyword "ciao")        ⇒ #:ciao
Function: keyword? obj

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

Function: keyword=? keyword1 keyword2

The arguments keyword1 and keyword2 must be keyword objects, otherwise an exception is raised. Return #t if the arguments are equal. A keyword object is equal to itself; two distinct keyword objects are equal if they have the same symbol.

Function: keyword-hash keyword

Return an exact integer suitable to be used as hash value for keyword used as key for hash tables.