Next: Structures Up: The Instructions Previous: Constants

Lists

The operations on lists are divided into three classes:

  1. construction: cons
    cons creates a cons pair; general lists are first transformed into cons lists, as described in section 6.2.2
  2. selection: car, cdr
    with car and cdr, cons pairs are taken apart; by successive application of cdr, any list element can be accessed
  3. test: null, consp
    null tests for an empty list (nil), consp for a non-empty list (a cons pair)

For the access functions car and cdr, the accessed heap entries have to be dereferenced because they could have been created by REL in the context of free variables (which were bound later) and then passed to LL. Entries put on the stack have always to be dereferenced in order to avoid unnecessary dereferencing when multiply accessing arguments or local variables. Dereferencing is denoted by .


Harold Boley & Michael Sintek (sintek@dfki.uni-kl.de)