A Symbol is simply a name for something -- eg. the name of a
variable, function or class. Most computer languages don't allow the
program to manipulate symbols -- Lisp is slightly different in that
functions and names of functions are valid data structures which can be
manipulated within the language much as Strings or
Integers can be.
The following creates a Symbol:
Fred
Similarly, you can convert a String to a Symbol as follows:
("Hello".symbol)
using the symbol method.
| method name | description |
|---|---|
length |
return the length of the symbol |
string |
get a string representation of the symbol |
== |
test for equality of symbols |
lengthReturn the length of the symbol.
Arguments: none
Return type: Integer
stringGet a string representation of the symbol.
Arguments: none
Return type: string
==
Test for equality of symbols. If the symbols are the same, the Symbol
true is returned, otherwise the empty List ()
is returned.
Arguments:
| sym | Symbol |
Return type: Symbol true
or the empty List ()
| Contents | Index | Current topic: objects | Related links: built-in objects |