I admit that (/: %) is pretty cute, but the % function takes lots of bits of significance, more than the input:

   =!.0/ % 0 10 + 1e18
1

22 b.&imin is a better function than % for this purpose.

Henry Rich

On 10/22/2021 9:33 AM, R.E. Boss wrote:
bingo!

-----Original Message-----
From: Programming <[email protected]> On Behalf Of Ben 
Gorte
Sent: vrijdag 22 oktober 2021 14:54
To: [email protected]
Subject: Re: [Jprogramming] sorting up and up

Ha!


(\:%) i:10

0 1 2 3 4 5 6 7 8 9 10 _10 _9 _8 _7 _6 _5 _4 _3 _2 _1


On Fri, 22 Oct 2021 at 20:14, 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


--
This email has been checked for viruses by AVG.
https://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to