1. When a verb is executed on an empty argument, it executes on a cell of fills to find the shape of the result (using atomic 0 as the result if the execution fails)

2. The shape of (integerarray { otherarray) is ($integerarray, (shape of an item of otherarray)).

These are inconsistent.  It's not obvious, but here's an example:

   (0$0) { i. 0 3

The x argument has a 0 in the frame, so it should execute on a cell of fills; that is, the verb should start by executing

  0 { i. 0 3

This fails with index error, so the result of the fill-cell execution should be taken to be atomic 0, and the overall result should have shape (,0).

It doesn't because (integer { array) is implemented as if { had infinite left rank. ((0$0) {"{ i. 0 3) produces the correct result.

I fixed that, so that { produced the right result, but it broke something in sparse-array processing that depended on the old rules. I am now wondering if there might be user code too that depends on this erroneous behavior.


  A similar case is

   (i. 0 2) +"1 i. 0 3

This fails with length error, but by the fill rules it should produce (0$0).


I would like to have a discussion about the right course of action with the JE. We could:

1. Leave the current inconsistent behavior as is (yuk!).
2. Make { conform to the spec, violating rule 2 above and possibly causing errors in the field
3. Others?

Henry Rich


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

Reply via email to