The Modula-3 Program: src/LinkedList.ig

  1 (*  LinkedList.ig:  a generic linked list (interface)  *)
  2 
  3 GENERIC INTERFACE LinkedList (Element);
  4 
  5 
  6 (*  A node in the list is a pointer to a two-field record.  *)
  7 
  8 TYPE T = REF RECORD head: Element.T; tail: T END;
  9 
 10 
 11 (* The type is not opaque so no operations are really needed,
 12    but for convenient we provide the constructor "cons".     *)
 13 
 14 PROCEDURE Cons (READONLY head: Element.T; READONLY tail: T): T;
 15 
 16 END LinkedList.