Continuing with 1D and allowing for negative shift I have the following Still no 2D version, though.
s=: adverb define : if. m >: 0 do. s=. y,~ m {.x f=. x, (1-m){.y else. s=. y, (m-1){.x f=. x,~ (-m){.y end. f,:s ) mean=: +/ % # mean (i. 5) _1 s 2* i. 4 0 1 2.5 4 3 4 -- (B=) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm