Warning: This is the manual of the legacy Guile 2.0 series. You may want to read the manual of the current stable series instead.

Next: , Previous: , Up: SRFI Support   [Contents][Index]


7.5.41 SRFI-88 Keyword Objects

SRFI-88 provides keyword objects, which are equivalent to Guile’s keywords (see Keywords). SRFI-88 keywords can be entered using the postfix keyword syntax, which consists of an identifier followed by : (see postfix keyword syntax). SRFI-88 can be made available with:

(use-modules (srfi srfi-88))

Doing so installs the right reader option for keyword syntax, using (read-set! keywords 'postfix). It also provides the procedures described below.

Scheme Procedure: keyword? obj

Return #t if obj is a keyword. This is the same procedure as the same-named built-in procedure (see keyword?).

(keyword? foo:)         ⇒ #t
(keyword? 'foo:)        ⇒ #t
(keyword? "foo")        ⇒ #f
Scheme Procedure: keyword->string kw

Return the name of kw as a string, i.e., without the trailing colon. The returned string may not be modified, e.g., with string-set!.

(keyword->string foo:)  ⇒ "foo"
Scheme Procedure: string->keyword str

Return the keyword object whose name is str.

(keyword->string (string->keyword "a b c"))     ⇒ "a b c"