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
