3.2 Functions on Dotted-Pairs

The following are elementary functions on dotted-pairs. All functions in this section which require dotted-pairs as parameters detect a type mismatch error if the actual parameter is not a dotted-pair.

CAR(U:dotted-pair):any eval, spread
 
CAR(CONS(a, b)) a. The left part of U is returned. The type mismatch error occurs if U is not a dotted-pair.

CDR(U:dotted-pair):any eval, spread
 
CDR(CONS(a, b)) b. The right part of U is returned. The type mismatch error occurs if U is not a dotted-pair.

The composites of CAR and CDR are supported up to 4 levels, namely:

     

CAAAARCAAARCAAR
CAAADR CAADR CADR
CAADAR CADARCDAR
CAADDR CADDR CDDR
CADAAR CDAAR
CADADR CDADR
CADDAR CDDAR
CADDDR CDDDR
CDAAAR
CDAADR
CDADAR
CDADDR
CDDAAR
CDDADR
CDDDAR
CDDDDR

CONS(U:any, V:any):dotted-pair eval, spread
 
Returns a dotted-pair which is not EQ to anything and has U as its CAR part and V as its CDR part.

LIST([U:any]):list noeval, nospread, or macro
 
A list of the evaluation of each element of U is returned. The order of evaluation need not be first to last as the following definition implies.a
FEXPR PROCEDURE LIST(U);

  EVLIS U;

RPLACA(U:dotted-pair, V:any):dotted-pair eval, spread
 
The CAR portion of the dotted-pair U is replaced by V. If dotted-pair U is (a . b) then (V . b) is returned. The type mismatch error occurs if U is not a dotted-pair.

RPLACD(U:dotted-pair, V:any):dotted-pair eval, spread
 
The CDR portion of the dotted-pair U is replaced by V. If dotted-pair U is (a . b) then (a . V) is returned. The type mismatch error occurs if U is not a dotted-pair.