Symbol

 

Symbol Overview

At least within the United States, Lisp has become the defacto language of choice for symbolic processing. Of course, the Symbol object plays a central role in symbolic processing. Essentially a Symbol object is a string, but a string with certain important properties.

The most difficult aspect of Symbol objects is their simplest aspect. Symbols are things in and of themselves (each Symbol has a system-wide unique text value). In the global context, a Symbol also has a global variable value. In the local context, a Symbol may have a local variable value different from its global variable value. Whether a Symbol object refers to itself, its global, or its local variable contents is controlled, in Lisp, with quoting.

When to Use

The Symbol object is used in any situation that a named identifier is need to hold global or local values. In other words, Symbols are used to label a container. Furthermore, since Symbol objects are unique, Symbols should be used instead of Strings where storage is to be minimized.

Quoted Symbol

A quoted symbol always refers to itself. In this sense, it acts as a kind of unique String object. The following simple example may be helpful.

(setq xyz 20) ;; Set the global value of the Symbol |xyz| (no colon or quote).

xyz:[0] => #\x ;; Return the 1st character in the text value of the |xyz| Symbol

xyz:[1] => #\y ;; Return the 2nd character in the text value of the |xyz| Symbol

xyz:[2] => #\z ;; Return the 3rd character in the text value of the |xyz| Symbol

(setq xyz 'abc) ;; Set the global value of the Symbol |xyz| to the Symbol |abc|.

(setq xyz abc:) ;; Set the global value of the Symbol |xyz| to the Symbol |abc|.

Note: In Lisp the colon (trailing) and the quote (leading) have the same meaning when used with a Symbol.

Unquoted Symbol

An unquoted symbol always refers to the local or global variable value of the Symbol (depending upon the context). In this sense, it is used to name containers (variables) which may hold values during program operation. The following simple example may be helpful.

(setq xyz 20) ;; Set the global value of the xyz variable (no colon or quote).

xyz ;; Return the global value of the xyz variable 20

(setq xyz 'abc) ;; Set the global value of the Symbol |xyz| to the Symbol |abc|.

(setq xyz abc:) ;; Set the global value of the Symbol |xyz| to the Symbol |abc|.

Note: In Lisp the colon (trailing) and the quote (leading) have the same meaning when used with a Symbol.

xyz[0] => #\a ;; Return the 1st character of the value held in the xyz variable

xyz[1] => #\b ;; Return the 2nd character of the value held in the xyz variable

xyz[2] => #\c ;; Return the 3rd character of the value held in the xyz variable

Note: In Lisp, local and global variables are determined by context, as follows.

 

(setq xyz 20) ;; Set the global value of the xyz variable (no colon or quote).

xyz ;; Return 20, the global value of the xyz variable

(defun foo()

vars: ( xyz ) ;; Define the local xyz variable (different from the global ;; variable)

(setq xyz 30) ;; Set the local value of the xyz variable (no colon or quote).

xyz ;; Return the local value of the xyz variable

) ;; end of foo function

 

(setq abc (foo)) ; The global variable abc is set to 30

xyz ; Returns 20, the global value of xyz

Object Data Types

The BitVector is a Heap Object or an Object Data Type. The Analytic Information Server Object Types are stored in the Heap and are managed by the Heap manager. The Analytic Information Server Heap manager supports object resizing, garbage collection, and anti-fragmentation algorithms so that the user may concentrate on the analysis and modeling of data rather than on memory management. Without exception, all of the Object types are identified by an object id. The object id identifies a block of memory, managed by the Lambda Information Server memory manager, in which the Object's data is stored.

The Analytic Information Server Heap Object and Native Data types can be saved and loaded to and from persistent (disk file) storage at any time. Containers with immediate data are saved on disk in fixed length records equal to the size of the container. Containers with Heap object references are saved in fixed length records, which are automatically expanded to include the contents of the Heap object, and any objects referenced by the Heap object, etc. This feature is called Object Closure Management and is automatic with every Analytic Information Server container database save.

Analytic Information Server containers may be loaded from any database repository record at any time. If the data in the record is immediate, the database load fills the container with the immediate data. If the data in the record is an object closure, the database load fills the container with a Heap object reference, and all of the objects in the record are loaded back into the Heap with the same referential relationships they had when they were saved in the repository.

 

Data Type Examples

The Symbol object can be demonstrated by the following examples.

Example_Symbol_(sym)add1_001 Example_Symbol_(sym)addValue_001 Example_Symbol_(sym)divValue_001 Example_Symbol_(sym)mulValue_001
Example_Symbol_(sym)sub1_001 Example_Symbol_(sym)subValue_001 Example_Symbol_addMethod_002 Example_Symbol_append_003
Example_Symbol_compareEQ_002 Example_Symbol_compareGE_002 Example_Symbol_compareGT_002 Example_Symbol_compareLE_002
Example_Symbol_compareLT_002 Example_Symbol_compareNE_002 Example_Symbol_compare_002 Example_Symbol_comparison_002
Example_Symbol_defMethod_003 Example_Symbol_downcase_002 Example_Symbol_getGlobalValue_001 Example_Symbol_getGlobalValue_002
Example_Symbol_getSymbolTable_001 Example_Symbol_getSymbolTable_002 Example_Symbol_hashString_002 Example_Symbol_isCharAlphabetic_002
Example_Symbol_isCharAlphanumeric_002 Example_Symbol_isCharLowercase_002 Example_Symbol_isCharName_002 Example_Symbol_isCharNumeric_002
Example_Symbol_isCharUppercase_002 Example_Symbol_isCharWhitespace_002 Example_Symbol_isObject_002 Example_Symbol_isSymbol_001
Example_Symbol_isType_004 Example_Symbol_length_003 Example_Symbol_makeQuotedSymbol_001 Example_Symbol_methodsOf_004
Example_Symbol_new_002 Example_Symbol_proplist_001 Example_Symbol_proprecord_001 Example_Symbol_putprop_001
Example_Symbol_ref_003 Example_Symbol_remProp_001 Example_Symbol_send_002 Example_Symbol_setq_001
Example_Symbol_setq_002 Example_Symbol_sizeof_002 Example_Symbol_symbol_001 Example_Symbol_symbol_002
Example_Symbol_type_002 Example_Symbol_upcase_004