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