[Jprogramming] Where, oh where have my indices...

Elijah Stone elronnd at elronnd.net
Wed Oct 27 03:32:40 UTC 2021


I think that primitives should try to handle as highly-ranked an array 
they can.  I find it much more simple and regular to explicitly lower the 
rank of a verb than to recreate the high-rank version of the algorithm 
myself.

I had a similar issue recently with #.: it is effectively a trailing-axis 
reduction, and I wanted to reduce the leading axis, so I had to write 
#.&.|:.  I would much rather have written #., and used #."1 if I 
explicitly wanted to reduce the last axis.

I do not know if this argument is strong or objective, but: in general, if 
primitives have natively high rank, then lower-ranked versions can be 
produced in a uniform manner; whereas if primitives are low-ranked, then 
distinct high-ranked versions must be produced for each relevant 
primitive.

  -E

On Tue, 26 Oct 2021, Henry Rich wrote:

> First: rank "_1 is shorthand for "_1"_ . Every verb must have 
> nonnegative rank.
>
> Second: it seems to me that the current definition of I. is more 
> convenient for some things (where f at I. is used) and less for others 
> (where I.@, is used).  Is there any strong objective argument one way or 
> the other?
>
> Henry Rich
>
> On 10/26/2021 1:56 AM, Elijah Stone wrote:
>> On Mon, 25 Oct 2021, Marshall Lochbaum wrote:
>>
>>> If I. combined the two, functions written with the high-rank version 
>>> would usually fail in this case. Better to make the programmer 
>>> remember an idiom than to provide an incomplete version of it.
>>
>> No definition could be less amenable to high-rank computation than the 
>> current one.  And for code which does want to go that mile, "_1 is 
>> much nicer (IMHO).
>>
>>  -E
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> -- 
> 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
>


More information about the Programming mailing list