class List_double_3d_ { public double [3d] car; public List_double_3d_ cdr; // Main constructor. public List_double_3d_(double [3d] x, List_double_3d_ rest) { car = x; cdr = rest; } public List_double_3d_(double [3d] x) { car = x; cdr = null; } public List_double_3d_ cons(double [3d] x) { return new List_double_3d_(x, this); } public inline double [3d] first() { return car; } public inline List_double_3d_ rest() { return cdr; } // Destructive append. public List_double_3d_ concat(List_double_3d_ l) { if (l != null) for (List_double_3d_ q = this; ; q = q.cdr) if (q.cdr == null) { q.cdr = l; break; } return this; } public int length() { int i = 0; List_double_3d_ r = this; while (r != null) { i++; r = r.rest(); } return i; } }