www.delorie.com/gnu/docs/kawa/kawa_29.html   search  
 
Buy GNU books!


Kawa, the Java-based Scheme system

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.4 Keywords

Keywords are similar to symbols. The main difference is that keywords are self-evaluating and therefore do not need to be quoted in expressions. They are used mainly for specifying keyword arguments.

 
keyword ::= identifier:

An alternative syntax, with the colon first, is supported for compatibility with Common Lisp and some other Scheme implementations:

 
keyword ::= :identifier

Putting the colon first has exactly the same effect as putting it last; putting is last is recommended, and is how keywords are printed.

A keyword is a single token; therefore no whitespace is allowed between the identifier and the colon (which is not considered part of the name of the keyword).

Function: keyword? obj
Return #t if obj is a keyword, and otherwise returns #f.

Function: keyword->string keyword
Returns the name of keyword as a string. The name does not include the final #\:.

Function: string->keyword string
Returns the keyword whose name is string. (The string does not include a final #\:.)


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003