class PermuteTest { public static void dump(String local s, int [3d] local x) { foreach (p in x.domain()) System.out.println(s + "[" + p[1] + ", " + p[2] + ", " + p[3] + "] = " + x[p]); } public static void main(String[] args) { int [3d] local x = new int [[0 : 2, 0 : 3, 0 : 4]]; int [3d] local y = x.permute([3, 2, 1]); /* invertable */ int [3d] local z = x.permute([2, 1, 3]); /* invertable */ int [3d] local w = x.permute([2, 3, 1]); /* not invertable */ foreach (p in x.domain()) x[p] = p[1] * 100 + p[2] * 10 + p[3]; dump("x", x); dump("y", y); dump("z", z); dump("w", w); } }