sclass Tree { A a; L> children; *() {} *(A *a) {} *(A *a, Iterable> children) { this.children = cloneList(children); } toString { new LS out; toString(out, 0); ret lines(out); } // Note: This doesn't call the children() method void toString(LS out, int indent) { out.add(spaces(indent) + str(a)); for (Tree t : unnull(children)) t.toString(out, indent+2); } A value() { ret a; } // if you override, make sure to set field children L> children() { ret children; } }