2.8 File linkedlist.h

/* File: linkedlist.h */

#include <stddef.h>

/*==============================================
 * A list is a sequence of 0 or more integers.
 *
 * emptyList   is an empty list.
 *
 * isEmpty(L)  is true if L is empty.
 *
 * head(L)     is the first member of nonempty 
 *             list L.
 *
 * tail(L)     is the list obtained from nonempty
 *             list L by removing its head.
 *
 * cons(h,t)   is a list whose head is h and
 *             whose tail is t.
 *==============================================
 */

typedef struct listcell
{
  int              head;
  struct listcell* tail;
}
ListCell;

typedef ListCell* List;

extern List emptyList;

int 	isEmpty		(List L);
int 	head		(List L);
List 	tail		(List L);
List 	cons		(int h, List t);