There's a change I am tempted to make, but I think it would make the
code more complex.

So, instead, here's some "simplifications":

http://pastebin.com/xa5cgLwF

Here's a brief recap of my thinking:

J nouns know how big they are, so we should not add complexity to our
data structures to keep a redundant copy of this kind of information.

J verbs like to deal with collections, and letting them do that can
eliminate redundant processing.

J adverbs can generate "bytecode" if we keep their jobs simple enough,
so that's probably good.

We should be able to make g be a rank 3 array without any other code
changes (our starting and ending locations would also have to have 3
elements).  Untested.

Instead of reversing our lists of indices every time we use them, why
not just transpose the grid once?

(You can always add an explicit rank to a verb if you feel like
writing one that doesn't want to deal with collections.  So I think
that these changes should be fine from a modularity point of view.)

FYI,

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

Reply via email to