// TODO: test static O smallestList_set(O l, int i, O o) { if (i < 0 || i >= smallestList_l(l)) fail("Index out of bounds"); if (l cast Pair) { if (i == 0) l.a = o; else l.b = o; ret l; } if (l cast T3) { if (i == 0) l.a = o; else if (i == 1) l.b = o; else l.c = o; ret l; } if (l cast O[]) { l[i] = o; ret l; } ret o; }