On 4/30/07, Tracy Harms <[EMAIL PROTECTED]> wrote:
My last little J project has been posted on the wiki:
http://www.jsoftware.com/jwiki/TracyHarms/misc/wrapmap
I'd like peer review of one portion of my code, in
particular, where I suspect it may be clunky.
I don't understand what you are trying to do.
In particular, from your description, I'd expect move to be
defined as
move=: sz #. sz | *
In other words:
E move 5
1
Here, you have a four by four board, and so moving five squares
east is equivalent to moving entirely around the board and then
moving one square east.
That said, rather than representing the result as a single index,
it might make more sense to represent the result as a
coordinate offset:
mv=: sz | *
In other words:
E mv 5
0 1
But... ultimately, what really matters is your application context.
And, I don't know what that would be.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm