6.28 Symbols
A symbol value reflects internal representation of syntax-object identifier content, without the binding or source-location information that is associated with an identifier. A symbol is similar to a string, but symbols are typically interned and they are equal by == only when they are equal by ===. The #' operator can produce a symbol value.
Symbols are comparable, which means that generic operations like < and > work on symbols. Comparsion of two symbols is the same as comparing the string forms of the symbols.
annotation |
expression |
|
expression |
|
repetition |
|
repetition |
|
binding operator |
|
binding operator |
function | ||
| ||
function | ||
| ||
function | ||
> Symbol.from_string("apple")
#'apple
> Symbol.from_string("apple") == #'apple
#true
> Symbol.uninterned_from_string("apple")
#'apple
> Symbol.uninterned_from_string("apple")
== Symbol.uninterned_from_string("apple")
#false
> Symbol.unreadable_from_string("apple")
#'apple
> Symbol.unreadable_from_string("apple") == #'apple
#false
> Symbol.unreadable_from_string("apple")
== Symbol.unreadable_from_string("apple")
#true
function |
|
function |
fun Symbol.gen(name :: ReadableString || Symbol) :: Symbol |