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".