using System; public class List { static int NULL=0; static int TOP=32767; List_Node hd; public int head () // head { if (hd != null) return (hd.getData()); else { Console.WriteLine("*****ERROR***** hd applied to empty list"); return TOP; } } public List tail () // tail { List Tail=new List(); if (hd !=null && hd.tail !=null) Tail.hd=hd.tail; return Tail; } public List cons (int cont) // cons { List newlist=new List(); newlist.hd=new List_Node(hd, cont); return newlist; } public bool isNull () { if (hd==null) return true; else return false; } } class List_Node { public List_Node tail; private int contents; public List_Node() { tail=null; contents=0; } public List_Node(int cont) { tail=null; contents=cont; } public List_Node(List_Node theNextNode, int Cont) { tail=theNextNode; contents=Cont; } public int getData() { return contents; } }