public Value append(List l2) { Value[] elements = new Value[size() + l2.size()]; for (int i = 0; i < size(); i++) elements[i] = elementAt(i); for (int i = 0; i < l2.size(); i++) elements[i + size()] = l2.elementAt(i); return new List(elements); }
public static List cons(Value head, List tail) { Value[] values = new Value[tail.size() + 1]; values[0] = head; for (int i = 0; i < tail.size(); i++) values[i + 1] = tail.elementAt(i); return new List(values); }