5 Symbols

Two symbols are eq? iff they have the same external representation. Symbols are immutable, and the symbol type is encapsulated. The external representations of symbols are usually identifiers. However, symbols with other external representations may be created. Symbols whose external representation is enclosed within “|” (that is “| … |”) can contain any character supported by klisp, “|” and “\” can be included by escaping them with a leading “\” (that is “\|” and “\\”). Characters in symbols can also be specified with a unicode hex escape by using the syntax “\x<hex codepoint>;”. This works whether using the “| … |” syntax or not.

— Applicative: symbol? (symbol? . objects)

The primitive type predicate for type symbol. symbol? returns true iff all the objects in objects are of type symbol.

— Applicative: symbol->string (symbol->string symbol)

Applicative symbol->string returns the name of symbol as a string. The string returned is immutable.

— Applicative: string->symbol (string->symbol string)

Applicative string->symbol returns the symbol with name string. The symbol is always interned, which means, that it is always the case that:

          (eq? <symbol> (string->symbol (symbol->string <symbol>)))
               ⇒ #t

string->symbol can create symbols whose external representation aren’t identifiers. klisp uses the r7rs external representation for such symbols and so all symbols can be written and read back.