is_symbol(obj)
Return true
if obj
is a symbol, otherwise return false
.
Symbols are used for a variety of purposes as symbolic names in Slogan programs. Strings could be used for most
of the same purposes, but an important characteristic of symbols makes comparisons for equality much more efficient.
Two symbols with the same name are identical in the sense of is_eq
. This is so because
two symbols with the same sequence of characters are always stored in the same location in memory.
Symbol constants are written by prefixing identifiers with the quote mark ('). All characters valid in identifiers can be used in symbols.
Symbols with spaces and special characters are written by enclosing the symbol in tick (`) quotes, e.g: '`hello world`
.
is_symbol('abc)
// true
is_symbol(string_to_symbol("abc"))
// true