As I recall, the issue was as follows:
12 66 (2 1;0 2)} 3 3$0 NB.amend 2 atoms with 2 atoms; ok
0 0 66
0 0 0
0 12 0
(,66) (,<0 2)} 3 3$0 NB.amend 1 atom with 1 atom; ok
0 0 66
0 0 0
0 0 0
'' ''} 3 3$0 NB. amend 0 atoms with 0 atoms; not ok ??
|length error
| '' ''}3 3$0
This was generic code which needed a special case to deal with empty m.
When } encounters an empty m, it assumes m to be an empty list of major cell
indices, and errors if x does not have the appropriate shape. I am suggesting
that it should give the user the benefit of the doubt and therefore, for empty
m, if there is _any_ k such that the amend would be valid if m selected
k-cells, it should not err.
Why do you say } is a mess?
On Sun, 3 Jul 2022, Henry Rich wrote:
?
99 (i. 2 2)} i. 5 5
0 99 2 3 4
5 6 7 8 9
10 11 12 99 14
15 16 17 18 19
20 21 22 23 24
99 (i. 2 2)} i. 3 4 2
0 1
99 99
4 5
6 7
8 9
10 11
12 13
14 15
16 17
18 19
20 21
99 99
Each row of m addresses a cell of y, with rank (#$y)-({.$m).
----
This discussion ignores the main difficulty with x m} y, which is that m
{ y can be all over the place. m may choose subarrays from all over y,
putting them into one array of selected index-lists. x is then
distributed across these locations, with one cell of x possibly split
across values selected by different atoms of m. It's a mess in general.
----
Elijah, I am not opposed to making exceptions for empty selection, but I
haven't seen the value yet. You gave an example that I don't remember
exactly, where you ended up with a shape error on x, but I concluded
that you would have needed additional code even with the proposed
change. That was before I went on vacation. Can you make the case again?
Henry Rich
()
On 7/3/2022 7:51 AM, Raul Miller wrote:
On Sun, Jul 3, 2022 at 4:44 AM Elijah Stone <elro...@elronnd.net> wrote:
I am not sure how to feel about this. Mainly, I am not sure what the
difference is between x m}y and (for high-ranked numeric m) x (<"1 m)} y.
I
am also not sure what the difference is between your proposed semantics
and
the existing ones.
After thinking about this a bit, ... perhaps this rephrasing will make
sense:
Before J901, m (in x m} y) indexed items of y (and position in m had
to conform with x).
My thinking here was that the leading column of a rank 2 m should
still index items of a high ranked y. In the variant introduced in
J901, that's only the case when the last dimension of m equals the
rank of y.
There's definitely some other issues to consider, involving
conformance, but I think that analogy with the J8 behavior of amend
should serve, there.
--
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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm