> On Dec 7, 2017, at 8:47 AM, Roger Hui <[email protected]> wrote:
> 
>   old=: 0 2 7 0
>   n  =: #old
>   max=: >./old
>   i  =: old i. max
> 
>   ] s=: (-n) ]\ ((1+i)$0), max#1
> 0 0 0 1
> 1 1 1 1
> 1 1 0 0
>   +/s
> 2 2 1 2
> 
>   ] new=: (0 i}y) + +/s
> 2 4 1 2
> 
>   assert (+/old) -: +/new
> 1

Wow, thanks Roger!

-- 
Daniel Lyons




----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to