This is probably easy but I can't figure it out. How can I count the number
of consecutive 1s?

Another way to think about it is a running sum that resets upon hitting a
zero

input=:1 0 1 1 1 1 0 1

expected=: 1 0 1 2 3 4 0 1
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to