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

Reply via email to