srecord ListAndIndex(L list, int idx) { bool atEnd() { ret idx >= l(list); } A get() { ret _get(list, idx); } int size() { ret l(list); } toString { ret subList(list, 0, idx) + ", then " + subList(list, idx); } ListAndIndex plus(int ofs) { ret ListAndIndex(list, idx+ofs); } ListAndIndex minus(int ofs) { ret ListAndIndex(list, idx-ofs); } L list() { ret list; } int index aka idx() { ret idx; } ListAndIndex mapIdx(IF1_IntToInt f) { ret ListAndIndex(list, f.get(idx)); } }