3 datatype List<T> = nil | cons(class T, List<T>);
9 case cons(_,l): return 1 + length(l);
14 ostream& operator << (ostream& out, List<T> l)
17 case cons(h,t): out << h;
18 if (t != nil) out << ", ";
23 instantiate datatype List<int>;
26 { List<int> l = cons(1,cons(2,cons(3,nil)));
27 cout << "length [" << l << "] = " << length(l) << '\n';