Dan Bron wrote:
> I need running sums that obey traffic lights.  
>          sgs  0  1 1 1  0 0 0 0  1 1  0 0 0  1 1 1 1 1  0   1
>       0 1 2 3 0 0 0 0 1 2 0 0 0 1 2 3 4 5 0 1
> What's the most efficient way to express  sgs  ?

Perhaps:
   sgs=: -. (] - [: >./\ *) +/\

-- 
Raul

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

Reply via email to