Following up your good start:

a ,: <: +/ (* +/\"1) = a=: 1 2 1 1 2 3 2 3

1 2 1 1 2 3 2 3

0 0 1 2 1 0 2 1

a ,: <: +/ (* +/\"1) = a=: 5 6 5 5 6 5 7 6

5 6 5 5 6 5 7 6

0 0 1 2 1 3 0 2


On Wed, Mar 28, 2018 at 11:32 AM, Joe Bogner <[email protected]> wrote:

> I think this is an easy one but it's escaping me. How to calculate a
> running count of an item in a list?
>
> runct (1,2,1,1,2) -: 0,0,1,2,1
> runct (5,6,5,5,6) -: 0,0,1,2,1
>
> This seems to be a good start
>
>  = (5,6,5,5,6)
> 1 0 1 1 0
> 0 1 0 0 1
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to