Your missing last bucket can simply be repaired with (I.,#)@, But even then you run into the same error as xash with ?.@#~30 where the subsequence ... 28 16 16 26 ... should be split in 28 16 16 and 16 16 26, before continuing with 26 9 3 2.
R.E. Boss -----Original Message----- From: Programming <programming-boun...@forums.jsoftware.com> On Behalf Of Hauke Rehr Sent: donderdag 20 mei 2021 15:23 To: programm...@jsoftware.com Subject: Re: [Jprogramming] ups & downs so this is what I came up with but it’s still missing the last bucket (9 5) and it doesn’t read as well as xash’s version I strongly expect one could do better than to {.+i.@-.@-/ but I just don’t know how (let alone how to {~ < < of that better) ff =: (<@{~ 2 <&<&({. + i.@-.@(-/))"1@:]\ 1 I.@, 0 = 2+/\ 2&((<->)/\)) Am 20.05.21 um 14:20 schrieb Hauke Rehr: > correction: of course, it’s 2&((<->)/\) > > Am 20.05.21 um 14:15 schrieb Hauke Rehr: >> you can also use (2 (< - >)/\) instead of (}: (<+_1*>) }.) I think >> that way it’s going more in the “appreciated” direction :) >> >> Am 20.05.21 um 13:49 schrieb xash: >>> f=:((#~ 1&|.) ,&.> <;.1~) 0 1, 0= 2+/\ }: (<+_1*>) }. >>> >>> The first part assigns _1 to elements that are greater than the next >>> one, and 1 to elements that are less than the next one. Where _1 1 >>> or 1 _1 occur, a new group starts. Thus 0= 2+/\. >>> >>> This gets us the starting indices for <;.1. Because the borders >>> should be included, we prepend each element that is before a group >>> start `(#~ 1&|.)` to that group `,&.>` (thus the unusual `0 1,` for the >>> group starts). >>> -------------------------------------------------------------------- >>> -- For information about J forums see >>> http://www.jsoftware.com/forums.htm >>> >> > -- ---------------------- mail written using NEO neo-layout.org ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm