8.22. File tom/Cons

class tom.Cons

inherits

State supers: State

methods


instance (id)
  with (All, All) (a, d);

Return a newly allocated instance with the a and d as the car and cdr, respectively.


instance (id)
  cons All a
     : All d = nil;

Return a newly allocated instance with the a and d as the car and cdr, respectively. The cdr d defaults to nil.

instance tom.Cons

variables

public Any car;

The element contained in this Cons cell, and the remainder of the list.

public Any cdr;

methods


protected id (self)
  init (All, All) (a, d);

Designated initializer.


boolean
  consp;

Return YES.


(Any, Any)
  decons;

Return the (car, cdr) in a tuple.


void
  set_car All c;

Set the car to the object c.


void
  set_cdr All c;

Set the cdr to the object c.


void
  encodeUsingCoder Encoder coder;

Encode the receiving object to the coder.


boolean
  equal id other;

Return TRUE if the receiving list is equal to the other list. Elements are compared with equal.


int (value)
  hash;

Use the car and cdr to compute a hash value for this Cons cell.


void
  initWithCoder Decoder coder;

Decode the receiving object from the coder.


id
  member All object;

Return the Cons cell whose car is equal to the object.


id
  memq All object;

Like member, but the element is identified on reference equality.


OutputStream
  write OutputStream s;

Output the list, of which the receiving Cons cell is the start, to the stream s.


OutputStream
  writeListElement OutputStream s;

Continue outputing the list, of which the receiving Cons cell is an element and not the head, to the stream s.