On 5/21/08, John Randall <[EMAIL PROTECTED]> wrote:
> T=:2&!@>:
> f=:({: + T@:(+/))"1
> odometer=: #: i.@(*/)
>   |.|: 5 5 $ f odometer 5 5
> 14 19 25 32 40
>  9 13 18 24 31
>  5  8 12 17 23
>  2  4  7 11 16
>  0  1  3  6 10

I think this would be simpler without
the odometer function:
   |.|: f@,"0/~ i. 5
14 19 25 32 40
 9 13 18 24 31
 5  8 12 17 23
 2  4  7 11 16
 0  1  3  6 10

And, for that matter, I am not sure why that
form is better than f@,"0/~ i. 5

Also, I think I would prefer to use a dyad
   F=: [ + [EMAIL PROTECTED]  NB. ([ + (-:@+ *:)@+)
   F"0/~i.5
but, unfortunately, this approach does not
lend itself well to finding an inverse.

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

Reply via email to