Structures

An Isis structure is a data storage construct meant to resemble
a C structure. An Isis structure holds an unordered collection of
named fields, each of which contains a value. You may create as many
structures as you wish, and you may add, modify, query, and remove
fields inside a structure at any time.

Creating a structure

(new-structure) # create new empty structure
(new-structure field-value-list) # sets initial fields and values
new-structure creates a new structure object and returns it
as a procedure. You can modify and query the structure by calling
this procedure with different kinds of arguments. If desired, you may
pass a list of field-value pairs to initialize the structure.

Adding or modifying a field

(strc field val) # adds or modifies a field
Calling a structure with 2 arguments adds a new field or resets the
value of an existing field in a structure. The first argument is the
field's reference value (the field's "name"). This reference value
may be any Isis value. The second argument is the value that
should be placed in that field.

Removing a field

(strc field Null) # removes a field
Calling a structure with a field reference and value of Null
will delete that field from the structure.

Retrieving the value of a specific field

(strc field) # retrieves value of field
Calling the structure with just the field reference retrieves the
value of that field, or returns Null if the field does not
exist.

Retrieving the entire contents of a structure

(strc) # retrieves entire structure
Calling the structure with no arguments returns the entire structure
in the form of a list of field-value pairs. By passing this list as
the argument to new-structure, a separate copy of a structure
can be made if desired.

Reading and writing structures

(write-structure port strc) # write a structure to a file
(read-structure port strc) # read a structure from a file
These functions read and write structures to files.
write-structure writes the contents of the given structure to
the given file handle port in a human-readable format.
read-structure reads fields in the same format from
port into the given structure, which may be empty or already
contain some fields (any fields that are duplicated will be
overwritten).