On 6/17/08, June Kim <[EMAIL PROTECTED]> wrote: > Now, the next part. You want to make the code general, so it can treat > n-dimension. ... > How would you generalize guard code in J style? I believe there is a > simple solution.
guard=: ({.~ _1 - $)@({.~ 1 + $)
guard 1 2 3
0 1 2 3 0
guard 1 2 3,:4 5 6
0 0 0 0 0
0 1 2 3 0
0 4 5 6 0
0 0 0 0 0
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
