Folks; This thread just points to the superiority of J, any executable notation in fact, over English, especially if it has been translated from Korean, as a specification language. The more J gets spoken in these forums, the quicker things get resolved.
------------------------------------------------------------------------ |\/| Randy A MacDonald | APL: If you can say it, it's done.. (ram) |/\| [EMAIL PROTECTED] | |\ | | The only real problem with APL is that BSc(Math) UNBF'83 | it is "still ahead of its time." Sapere Aude | - Morten Kromberg Natural Born APL'er | Demo website: http://156.34.82.188/ -----------------------------------------------------(INTP)----{ gnat }- ----- Original Message ----- From: "June Kim" <[EMAIL PROTECTED]> To: "Programming forum" <[email protected]> Sent: Wednesday, January 31, 2007 8:00 AM Subject: Re: [Jprogramming] sliding window > 2007/1/31, R.E. Boss <[EMAIL PROTECTED]>: > > Shouldn't your result be > > > > 5; 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; 3 > > > > where the 5 at the start and the 3 at the end are added? > > No. But Thanks anyway. > > Let me try the definition again. > > The maximum of the window's size is given. When possible the window > should be as large as possible but not larger than its given maximum > size. The moving window's position is its center point. When the given > list is of size N, the number of windows should be N, too. The > window's position(center) starts from at index 0 of the list. The > window moves its position(center) by one to the right, until the > center point reaches the end of the list. > > > > They are the centre of a window of 1. > > This is also in accordance with the middle points you gave: 5, 10, 7 ..., 4, > > 3 > > > > But then the solution is simple: > > the middle points are given by d > > and the lengths of the windows are given by > > > > <./5,(,:|.)(+:+1:)i.#d > > 1 3 5 5 5 5 5 5 5 3 1 > > > > > > If you want the windows boxed then > > > > 5(<;._3 ([EMAIL PROTECTED],[,{:@]) ((,:-@|.)@(2&|#])@[EMAIL PROTECTED]) > > (<@{."0 _)"1 ]) d > > +-+------+----------+----------+---------+-----------+------------+--------- > > ---+------------+------+-+ > > |5|5 10 7|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|_1 4 3|3| > > +-+------+----------+----------+---------+-----------+------------+--------- > > ---+------------+------+-+ > > > > is a (first) solution, with thanks to McCormick who brought up <;._3 > > > > R.E. Boss > > > > > > > > -----Oorspronkelijk bericht----- > > Van: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] Namens June Kim > > Verzonden: woensdag 31 januari 2007 2:39 > > Aan: Programming forum > > Onderwerp: [Jprogramming] sliding window > > > > 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 > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
