I was evolving a halfway decent approach, but yours is far, far better. Pace J-P Jacobs, he seems to have missed your amendment; perhaps the messages passed each other by like ships in the night...
Anyway, the ] may be dropped, at the expense of a couple of brackets: foo =: /:(,.~3|3+*) Brilliant... perhaps what REB was after? Cheers, Mike PS - IFF we know there’s no zero: /: (,.~ -@*) Sent from my iPad > On 22 Oct 2021, at 13:04, Raul Miller <[email protected]> wrote: > > Or, if you need this to work when the argument is not ordered: > foo=: /: ],.~3|3+* > > Seems like there ought to be a simpler approach, though... > > -- > Raul > >> On Fri, Oct 22, 2021 at 8:00 AM Raul Miller <[email protected]> wrote: >> >> foo=: /: 3|3+* >> foo i:10 >> 0 1 2 3 4 5 6 7 8 9 10 _10 _9 _8 _7 _6 _5 _4 _3 _2 _1 >> >> -- >> Raul >> >>> On Fri, Oct 22, 2021 at 5:14 AM R.E. Boss <[email protected]> wrote: >>> >>> Some time ago I stumbled on an elegant solution to sort a sequence of >>> numbers such, that first the non-negative numbers were sorted up, >>> immediately followed by the negative numbers sorted up, like >>> >>> foo i: 10 >>> 0 1 2 3 4 5 6 7 8 9 10 _10 _9 _8 _7 _6 _5 _4 _3 _2 _1 >>> >>> Any takers? >>> >>> >>> R.E. Boss >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
