On Tue, Mar 8, 2011 at 8:42 PM, Henry Rich <[email protected]> wrote: > We have > > dyad (<"1@[ { ]) > > which is backed by special code and gives a good way to read scattered > values from an array. I am looking for a comparable way to > scatter-write to an array without boxing all the points. > > I can't think of one, and I wonder whether we should define > > dyad m} > > where m is numeric of rank 2 or higher, as > > (<"1 m)} > > An incompatible change, but perhaps no one would notice.
I think this change could be made without it needing to be an incompatible change. Whether or not this is a good idea is of course a different question. Consider, for example: (100+i.3 2) (i.3 2)} i.8 100 101 102 103 104 105 6 7 (100+i.3 2) (i.3)} i.5 2 100 101 102 103 104 105 6 7 8 9 (100+i.3) (i.3 2)} i.5 6 |index error (100+i.3) (i.3 2)} i.6 6 |length error (100+i.3) (<"1 i.3 2)} i.6 6 0 100 2 3 4 5 6 7 8 9 10 11 12 13 14 101 16 17 18 19 20 21 22 23 24 25 26 27 28 102 30 31 32 33 34 35 (100+i.1) (i.1 2)} i.6 6 |length error Currently, cases where an implicit use of <"1 makes sense are error cases. They are typically length errors (though not always). The cases that need different treatment have frame agreement between the left argument of the dyad and the adverb argument, with one extra rank on the adverb argument. Also, the adverb argument's final dimension -- the one that guarantees a mismatch with the left argument -- matches the rank of the right argument. -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
