Probably just a glitch in what you are looking for in the second example, but
it can be done with a little processing before using ]\
4 ]\ i. 7
0 1 2 3
1 2 3 4
2 3 4 5
3 4 5 6
4 (]\ (, >:@{:)) i.7
0 1 2 3
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
Cheers, bob
> On Feb 19, 2018, at 11:13 AM, Raul Miller <[email protected]> wrote:
>
> 3 ]\i.6
> 0 1 2
> 1 2 3
> 2 3 4
> 3 4 5
>
> Or
> sw=: ]\
>
> Thanks,
>
> --
> Raul
>
>
> On Mon, Feb 19, 2018 at 2:09 PM, Skip Cave <[email protected]> wrote:
>> How can one create a sliding window in J?
>>
>> 3 sw i.6
>>
>> 0 1 2
>> 1 2 3
>> 2 3 4
>> 3 4 5
>>
>> 4 sw i.7
>> 0 1 2 3
>> 1 2 3 4
>> 2 3 4 5
>> 3 4 5 6
>> 4 5 6 7
>>
>> What is the J code for sw?
>>
>>
>>
>>
>>
>> Skip Cave
>> Cave Consulting LLC
>> ----------------------------------------------------------------------
>> 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