Suppose the following data is given d=: 5 10 7 8 9 2 1 100 _1 4 3
Now suppose a verb that moves a sliding window through the data d sw 5 The size of the window is always odd. For each item in the given data, the window should locate it at the middle point of the window. For some items that's nearby boundaries, the window size could be smaller than the given. The result should be 5 10 7; 5 10 7 8; 5 10 7 8 9; 10 7 8 9 2; 7 8 9 2 1; 8 9 2 1 100; 9 2 1 100 _1; 2 1 100 _1 4; 1 100 _1 4 3; 100 _1 4 3; _1 4 3 Middle points for the window are 5, 10, 7 ..., 4, 3 What is an easy way for sw? ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
