Skip to content
Turtle Kitty edited this page Aug 9, 2015 · 5 revisions

symbol

A symbol is an interned string of runes - like a text, but without quotes.
They are used as identifiers for variables and object methods.
When used naked in code, they name another object.
When quoted, they name themselves. Due to the dot operator and symbolic module paths, neither periods (.) nor slashes (/) can be used in symbols. Well... slashes can, but then the dot operator won't work on that symbol.

(def foo 7)

(sys.print foo) -> 7
(sys.print (quote foo)) -> foo
(sys.print 'foo) -> foo

predicate

(symbol? x)

(def foo 7)
(symbol? foo) -> false (the unquoted symbol foo is evaluated, returning 7)
(symbol? (quote foo)) -> true
(symbol? 'foo) -> true
(symbol? "foo") -> false
(symbol? 'x) -> true
(symbol? $x) -> false
(symbol? 1) -> false

messages

x.type -> symbol

x.view -> x

x.to-bool -> true

x.to-text -> text version of x: foo -> "foo"

Clone this wiki locally