Next: , Previous: Library Reference, Up: Library Reference


3.1 Lists

The basic data structure used for representing virtual code and data in the avram library is declared as a list. The list type is a pointer to a structure having a head field and a tail field, which are also lists. The empty tree, nil, is represented by the C constant NULL. A tree of the form cons(a,b) is represented in C as a list whose head is the representation of a and whose tail is the representation of b.

A number of other fields in the structure are maintained automatically and should not be touched. For that matter, even the head and tail fields should be considered read-only. Because of sharing, it is almost never valid to modify a list “in place”, except for cases that are already covered by library functions.