While this primitve works nicely in an example:
(2 3 4) (17&|@*)/ table >:i.8
+-------+---------------------+
|17&|@*/|1 2 3 4 5 6 7 8|
+-------+---------------------+
|2 |2 4 6 8 10 12 14 16|
|3 |3 6 9 12 15 1 4 7|
|4 |4 8 12 16 3 7 11 15|
+-------+---------------------+
I find this less satisfying:
(2 3 4) (17&|@%)/ table >:i.8
+-------+-----------------------------------------------+
|17&|@%/|1 2 3 4 5 6 7 8|
+-------+-----------------------------------------------+
|2 |2 1 0.666667 0.5 0.4 0.333333 0.285714 0.25|
|3 |3 1.5 1 0.75 0.6 0.5 0.428571 0.375|
|4 |4 2 1.33333 1 0.8 0.666667 0.571429 0.5|
+-------+-----------------------------------------------+
I have a function which does what one would expect. I'll rename it as
m17div here, details unimportant for this discussion:
(2 3 4) m17div/ table >:i.8
+-------+---------------------+
|m17div/|1 2 3 4 5 6 7 8|
+-------+---------------------+
|2 |2 1 12 9 14 6 10 13|
|3 |3 10 1 5 4 9 15 11|
|4 |4 2 7 1 11 12 3 9|
+-------+---------------------+
( eg 3 % 2 == 10 mod 17 because 3 = 17 | 2 * 10 )
Would anyone else find this return of integer results useful or is it
better
to force a floating output?
(Henry tells me that m&|@^ returns integer results, working ok when m^2
can be represented as a non-extended integer.)
Thanks,
Mike
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm