It bothers me that we have to sacrifice correctness for performance. We use
@: and avoid @ for performance even though the verbs involved are scalar.
So I have a question. What does it mean when we speak of rank? Currently a
verb is repeated for each cell in a frame. Is that the definition of the
way rank is supposed to work? Another way to look at rank is that cells
within a frame are independent. That is, the result for any cell in the
frame is not affected by the values or results of other cells in the frame.
I prefer that interpretation over the first as it fits nicely with
multiprocessing. Something not supported in J at this time but I suspect
that it won't be long before it is an issue.
This second interpretation implies that cells may be processed in any order
or even concurrently. This second interpretation also allows user defined
scalar verbs to be vectorized when appropriate. Like is done for primitives
like + now. Then it would no longer be necessary to incorrectly use @: for
performance. But often a user defined verb must be run serially. It will
not work right if parallelized. Like if it includes "if." tests. But we
have no way at this time to tell J whether or not a verb should be
vectorized. Similarly some verbs may not work right is parallelized.
One possibility would be an extension to rank ("). Allow its argument to
optionally be boxed, the first item correspond to its current meaning and a
second item to assign attributes to the verb. There are several other
attributes that could be useful for optimization. Like commutative and
associative.
Just a weird thought.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm