Carapace

Symbol Class

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.

Symbol Creation

The following creates a Symbol:

    Fred

Similarly, you can convert a String to a Symbol as follows:

    ("Hello".symbol)
using the symbol method.

Symbol Properties

None

Symbol Methods

method name description
length return the length of the symbol
string get a string representation of the symbol
== test for equality of symbols


length

Return the length of the symbol.

Arguments: none

Return type: Integer


string

Get 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:

symSymbol

Return type: Symbol true or the empty List ()


Contents Index Current topic: objects Related links: built-in objects