User-type support would be much harder than has been supposed.

You could probably fix up the parser so that it converted (+: quaternion) to a suitable call.  The problem is going to be (+/@:*: quaternion) or the like.  The (+/@:*:) is parsed separately, so the execution-on-quaternions is going to have to handle any tacit verb - it has to be a full implementation of the syntax of J.  You might need to implement the execution of explicit definitions too, since you have to be able to pass a quaternion into them.

And what about

+:@> <quaternion

?  What would (<quaternion) do, anyway?  Somehow it has to create a box, which you can't do without using a primitive that doesn't understand quaternions.  Maybe you would say that < can apply to anything.  Ignoring the issue then of what the rank of a quaternion is, the sentence given above would pass a boxed quaternion into the standard J code for +:@>, which knows nothing about quaternions.  The JE is full of calls to itself, used to implement one primitive, or one special case of a primitive, in terms of another.  These calls do not go through the parser, and you would have to modify them, in their hundreds, one by one.

When all that story's finished, you will have to examine the places in the JE where it is assumed that multiplication is commutative (there's no list of them - you have to find them yourself) and add an implementation that does not assume commutativity.  The JE also assumes that multiplication distributes over addition, but that is satisfied for quaternions (but not for operators in general).

Henry Rich

On 11/2/2018 6:32 PM, Raul Miller wrote:
Actually, since the quaternion math is fairly well understood, the
difficulty of implementing a generic user type support might be higher
than implementing quaternion support. [Both because it would be doing
something more general, and because it would not be safe to ignore
cases that can be ignored for a quaternion implementation.]

That said, the payoff would be different: a user type support facility
could be used as a staging ground and perhaps a set of implementation
guidelines for both this and other projects (both useful and
spurious).

Thanks,



---
This email has been checked for viruses by AVG.
https://www.avg.com

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

Reply via email to