Sort and rotate?
(|.~ +/@:<&0)@(/:~) _10+10?.@$20
4 6 6 6 9 _5 _4 _4 _2 _2
Elijah Stone <[email protected]> wrote:
> This is not terrible, though the >: rankles:
>
> (/: ] + 0&> * [: >: >./ - <./) i: 10
> 0 1 2 3 4 5 6 7 8 9 10 _10 _9 _8 _7 _6 _5 _4 _3 _2 _1
>
> I am sure somebody else has a prettier solution.
>
> -E
>
> On Fri, 22 Oct 2021, R.E. Boss 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