On Mon, Jun 20, 2022 at 4:59 AM Elijah Stone <elro...@elronnd.net> wrote: > On Mon, 20 Jun 2022, Elijah Stone wrote: > > meaning that the shape of the result from indexing could be any prefix of $y > > I am not thinking straight, and should go to bed. Could be any _suffix_ of y. > Just reverse $x and $y, and I think the formula I gave before holds.
Hmm... suffix shape alignment was the APL approach. J used to use prefix shape alignment. But something odd is going on with } in this context: +/9e9=,9e9 (i.2 3)} i. 6 7 8 2 +/9e9=,9e9 (i.2)} i. 6 7 8 112 2*7*8 112 +/9e9=,9e9 (i.2 3)} i. 6 7 8 2 2*8 16 This is J903. On my phone (j701, though JVERSION is not defined), +/9e9=,9e9 (i.2 3)} i. 6 7 8 336 $,i.6 7 8 336 So I think that when the definition of } was changed -- https://code.jsoftware.com/wiki/System/ReleaseNotes/J901 -- it was implemented in a fashion which followed the APL conventions rather than the J conventions. The release notes say: "Language change: Scatter-amend support: x m} y changed when m is a numeric array of rank>1. In that case, each 1-cell of m is the index list of a cell of y that is replaced by the corresponding cell of x. This is an incompatible change with J8.07 and earlier, but is compatible with previous J9.01 betas." I think, in retrospect, this should have been: "Language change: Scatter-amend support: x m} y changed when m is a numeric array of rank>1. In that case, each 1-cell of m is the index list of a frame of y that is replaced by the corresponding frame of x. ..." Thanks, -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm