I found a problem that is said to an assignment for introductory C course but it turned to be not so trivial. It can be rephrased in J as: for a positive integer m find the array v or equivalently (m,m)$v so that result is a matrix with atoms of i.*:m filling in zig-zag order. (restricted to square matrix for time being)
example 4 4$0 1 5 6 2 4 7 12 3 8 11 13 9 10 14 15 0 1 5 6 2 4 7 12 3 8 11 13 9 10 14 15 I tackled the problem by noticing the sum of cell index pair for each layer is constant but run into trouble when need to eliminate extra pairs after passing the middle layer. All suggestions welcome. PS. zig-zag order is used in jpeg encoding http://en.wikipedia.org/wiki/JPEG -- regards, bill ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
