Directory Overview

A Directory is an object that is very similar to a Dictionary. Analytic Information Server Dictionary Objects and Directory objects share common properties: they both contain an arbitrary number of bindings, values can be referenced by key, or a single index, or two, and keys are always maintained in ascending sort order.

The only difference between a Directory and a Dictionary is they type of keys a Directory can have. A Directory key can be ANY Analytic Information Server type: native types as well as Object Types such as Symbol (Unquoted or Quoted), List, Pair (Unquoted or Quoted), all Vector types, Structure, Dictionary, Repository, or Lambda.

Directory Illustration

A Directory Object is analogous to a table containing exactly two columns and an arbitrary number of rows. The left column contains a key (must be any Analytic Information Server Native or Object type: Symbol, List, Pair, any Vector type, Structure, Dictionary, Repository, or Lambda), and the right column contains the value associated with its key. Any given row in a table is analogous to a Dictionary binding: Key/Value pair.

#Jan,1,1996 "Meeting with J.R. Mummy"
#Jan,12,1996 "Budget Deadline"
#Jan,19,1996 "Demo Product X"
#Jan,23,1996 "Leave for Boston"

When to Use

Directories are like Dictionaries, in that they are convenient for storing Key/ Value pairs. However, they have a maintenance overhead required for saving a richer universe of keys. An application that requires sorted Object keys would be more efficient by using a Dictionary.

Constant Form

The Directory native data type supports a constant form. The whole Directory constant is enclosed in braces and preceded by the sharp symbol, brace, and the dir| symbol (#{dir|). Some Directory constant examples:

#{dir| Name: "John Doe" Address: "184 Anywhere Street" City: "Los Angeles" State: "California"}

The constant form for Directories allows using the constant prefix, #{dir|| with two bars, to specify creating "as is" in unsorted order as follows:

#{dir|| Z: 5 Y: #{Mike: "father" Sally: "mother"} X: "Hello"}

Object Data Types

The Directory 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 Functions

The Directory object can be demonstrated by the following functions.

addMethod cdr compareEQ compareGE
compareGT compareLE compareLT compareNE
compare comparison copy count
defmethod delete insert inside
isAtom isBound isDirectory isEqual
isIdentical isInside isMember isObject
isType length map mapc
member methodsOf new objectToDirectory
refAttributes refValues ref remove
resize send setAttributes setCdr
setq sizeof sort type


Data Type Examples

The Directory object can be demonstrated by the following examples.

Example_Directory_addMethod_006 Example_Directory_cdr_004 Example_Directory_compareEQ_005 Example_Directory_compareGE_005
Example_Directory_compareGT_005 Example_Directory_compareLE_005 Example_Directory_compareLT_005 Example_Directory_compareNE_005
Example_Directory_compare_004 Example_Directory_compare_005 Example_Directory_comparison_005 Example_Directory_copy_003
Example_Directory_count_003 Example_Directory_defmethod_007 Example_Directory_delete_005 Example_Directory_delete_006
Example_Directory_insert_003 Example_Directory_inside_003 Example_Directory_isAtom_003 Example_Directory_isBound_003
Example_Directory_isDirectory_001 Example_Directory_isEqual_003 Example_Directory_isIdentical_003 Example_Directory_isInside_003
Example_Directory_isMember_003 Example_Directory_isObject_005 Example_Directory_isType_007 Example_Directory_length_006
Example_Directory_map_003 Example_Directory_mapc_003 Example_Directory_member_002 Example_Directory_member_003
Example_Directory_methodsOf_008 Example_Directory_new_005 Example_Directory_new_006 Example_Directory_objectToDirectory_001
Example_Directory_objectToDirectory_002 Example_Directory_objectToDirectory_003 Example_Directory_objectToDirectory_004 Example_Directory_refAttributes_003
Example_Directory_refValues_003 Example_Directory_ref_010 Example_Directory_ref_011 Example_Directory_ref_012
Example_Directory_remove_003 Example_Directory_resize_003 Example_Directory_send_005 Example_Directory_setAttributes_003
Example_Directory_setCdr_003 Example_Directory_setq_010 Example_Directory_setq_011 Example_Directory_sizeof_005
Example_Directory_sort_007 Example_Directory_sort_008 Example_Directory_sort_009 Example_Directory_type_008