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.
The primitive type predicate for type symbol.
symbol?returns true iff all the objects in
objectsare of type symbol.
symbol->stringreturns the name of
symbolas a string. The string returned is immutable.
string->symbolreturns 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->symbolcan 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.