@@ -0,0 +1,1964 @@
+package iProlog;%0Aclass IntList %7B%0A%0A final int head;%0A  final IntList tail;%0A%0A  private IntList(final int head) %7B%0A    this.head = head;%0A    tail = null;%0A  %7D%0A%0A  private IntList(final int X, final IntList Xs) %7B%0A    head = X;%0A    tail = Xs;%0A  %7D%0A%0A  static final boolean isEmpty(final IntList Xs) %7B%0A    return null == Xs;%0A  %7D%0A%0A  static final int head(final IntList Xs) %7B%0A    return Xs.head;%0A  %7D%0A%0A  static final IntList empty = null;%0A%0A  static final IntList tail(final IntList Xs) %7B%0A    return Xs.tail;%0A  %7D%0A%0A  static final IntList cons(final int X, final IntList Xs) %7B%0A    return new IntList(X, Xs);%0A  %7D%0A%0A  static final IntList app(final int%5B%5D xs, final IntList Ys) %7B%0A    IntList Zs = Ys;%0A    for (int i = xs.length - 1; i %3E= 0; i--) %7B%0A      Zs = cons(xs%5Bi%5D, Zs);%0A    %7D%0A    return Zs;%0A  %7D%0A%0A  static final IntStack toInts(IntList Xs) %7B%0A    final IntStack is = new IntStack();%0A    while (!isEmpty(Xs)) %7B%0A      is.push(head(Xs));%0A      Xs = tail(Xs);%0A    %7D%0A    return is;%0A  %7D%0A%0A  static final int len(final IntList Xs) %7B%0A    return toInts(Xs).size();%0A  %7D%0A%0A  @Override%0A  public String toString() %7B%0A    return toInts(this).toString();%0A  %7D%0A  %0A  public static int%5B%5D random(int seed)%7B%0A      int%5B%5D data;int random;%0A       data=new int%5B3%5D;%0A        for (int i=100,j=0;j%3C3;i=i*seed,j++)%7B%0A           random=i*seed+seed*(i-seed);%0A           data%5Bj%5D=random;%0A%0A       %7D%0A       return data;%0A%0A  %7D%0A public static void main(String args%5B%5D)%7B%0A%09  int a%5B%5D=random(2);%0A%09  IntList headEle = new IntList(a%5B0%5D);%0A%09  IntList curList = new IntList(a%5B1%5D, headEle);%0A%09  System.out.println(%22Elements = %22+ curList.toString());%0A%09  System.out.println(%22Head -%3E %22+ IntList.head(curList));%0A%09  System.out.println(%22Tail -%3E %22+ IntList.tail(curList));%0A%09  System.out.println(%22Length-%3E  %22+ IntList.len(curList));%0A%09  System.out.println(%22Added List with constructor -%3E %22 + IntList.cons(a%5B2%5D, curList));%0A%09  int b%5B%5D=random(2);%0A%09  System.out.println(%22added array List-%3E %22+ IntList.app(new int%5B%5D%7Bb%5B0%5D,b%5B1%5D,b%5B2%5D%7D, curList));%0A%0A %0A%7D%0A%7D%0A

Create IntList.java