'sh' finds a up-down circular path(?sorry my english).
A=."."0;._2 '101111 000100 111101 100111 101001 101111 ' A;A (<sh)^:_ B +-----------+-----------+ |1 0 1 1 1 1|0 1 0 0 0 0| |0 0 0 1 0 0|1 1 1 0 0 0| |1 1 1 1 0 1|0 0 0 0 0 0| |1 0 0 1 1 1|0 1 1 0 0 0| |1 0 1 0 0 1|0 1 0 0 0 0| |1 0 1 1 1 1|0 1 0 0 0 0| +-----------+-----------+ Did you intend 'sh2' ? sh2=: _1&(|.!.0"1) +. 1&(|.!.0"1) +. _1&(|.!.0) +. 1&(|.!.0) +. ] A;A (<sh2)^:_ B +-----------+-----------+ |1 0 1 1 1 1|0 1 0 0 0 0| |0 0 0 1 0 0|1 1 1 0 0 0| |1 1 1 1 0 1|0 0 0 0 0 0| |1 0 0 1 1 1|0 0 0 0 0 0| |1 0 1 0 0 1|0 0 0 0 0 0| |1 0 1 1 1 1|0 0 0 0 0 0| +-----------+-----------+ -- ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
