The description of S: seems to be misleading when it says
u S: n produces the list resulting from applying u to the argument(s) ...
which might make you think the result of u S: n is always a list.
Actually, it is a list of the results of u, and if they are not scalar,
the result is a higher-dimension array.
In $*S:0~5 6 you are applying * to a single 2-element list and it
returns a list of shape ,2 so the overall result is an array containing
1 item with that shape: overall result shape 1 2 .
Compare with
$*S:0 (5;6)
2
here, each result is a scalar, and the overall result is a list of 2
scalars.
$*S:0 < 5 6
1 2
i.S:0 <"0 i. 4
0 0 0
0 0 0
0 1 0
0 1 2
Each result of i. was put into an array.
$ i.S:0 < i. 4
1 0 1 2 3
See the leading 1, as described above. In general if you apply u S: n
to an unboxed operand you are going to get a leading 1 in the overall
result shape.
Henry Rich
Raul Miller wrote:
> Where does the leading 1 come from, in this shape?
>
> $*S:0~5 6
> 1 2
>
> Thanks,
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm