On Mon, Mar 3, 2014 at 3:39 AM, Michal Wallace <[email protected]> wrote:
> (-:x % y) <--> (x % +:y)
> 4**:x <--> *:+:x
>
> They're both kind of obvious things everybody knows, but for
> some reason they kind of jumped out at me using the notation.

That is a nice perspective, and yes - I can see what you are saying.

For the other problem, it's perhaps worth noting that you can sort in
linear time if you are sorting a sequence of integers with a known
minimum and a known maximum. And you can determine the minimum and the
maximum of a list in linear time.

Thus:
   radixsort=: (] #~ [: +/ =/) i.@(>./)

This is actually something of a trick - we are treating the maximum
value of the members of the list as a constant rather than as a
variable. Also, this version assumes no negative integers (so you'd
need to add 100 before sorting and then subtract 100 after, for your
example).

There's something of a problem reasoning about finite machines using
concepts based on infinities. What really matters is the time needed
to complete the operation.

Thanks,

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

Reply via email to