In the paper "Combinatory Logic and Combinators in Array Languages" they give a solution in APL:
vec ← 1 1 0 1 1 1 0 0 0 1
⍝ split (partition) on zeroes
⊆⍨vec
┌───┬─────┬─┐
│1 1│1 1 1│1│
└───┴─────┴─┘
⍝ size of each sublist
≢ ̈⊆⍨vec
2 3 1
⍝ max reduction
⌈/≢¨⊆⍨vec
3
For clarity, they also note:
The final maximum consecutive ones APL solution can be translated for those who don’t read APL:
reduce(max, map(length, W(partition, vec)))
So, how would one express the following in J?
⌈/≢¨⊆⍨vec
The ⊆ symbol seems to be a "partition" operator. It's not clear this exists in J but I may have just missed it. Curious what the above expression would be in "J".
Dan Bron's answer in the comments is the way to go for sure. I did a video on this problem and if you are interested you can watch me walk through the different options. https://www.youtube.com/watch?v=lbi_PMVbeaQ The version I ended preferring was
t=:[: >./ [: #;. _2 ,&0but I also look at
t=:[: {: [: $ [: ];. _2 ,&0as an alternative.