+/@:((*+/\)"1)@= 1 2 1 1 2
1 1 2 3 2
is the correct answer for the running count. (Ask your (grand)child.)
Elegant, but probably not efficient.
R.E. Boss
> -Original Message-
> From: Programming On
> Behalf Of Louis de Forcrand
> Sent: vrijdag 30 maart 2018 13:55
> To: programm..
Hiya,
rc=: i.~ (] - {) /:@/:
rc 1 2 1 1 2
0 0 1 2 1
Cheers,
Louis
> On 28 Mar 2018, at 20:32, Joe Bogner 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,