Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!news-server.csri.toronto.edu!torsqnt!jtsv16!blister!itcyyz!yrloc!rbe
From: rbe@yrloc.ipsa.reuter.COM (Robert Bernecky)
Subject: Re: Rank 0 catenation.
Message-ID: <1991Jun27.062017.1276@yrloc.ipsa.reuter.COM>
Keywords: rank, catenate , array , box
Reply-To: rbe@yrloc.ipsa.reuter.COM (Robert Bernecky)
Organization: Snake Island Research Inc, Toronto
References: <1991Jun24.161151.12366@watmath.waterloo.edu> <594@kepler1.kepler.com>
Date: Thu, 27 Jun 91 06:20:17 GMT

(Whoever posted this...) 

>use a lot each's on boxed nouns when I first started using J. Because J
>treats a boxed noun as a reference to data, rather than as the data themselves,
>that often led to some pretty convolved sentences on my part.
>
>Does anyone know why people seem to feel that "data nesting" as in APL2
>enclosed variables and "data referencing" as in J boxed nouns are incompatible
>with one another? They are probably implemented pretty much the same way as a
>data structure, the difference being the way the various verbs/functions of
>the language deals with them.

They are NOT incompatible. Perhaps my evil twin, xxx xxxxx, from IBM, 
has been passing such rumours around. APL2 arrays are a proper subset of
SHARP APL arrays, and anyone  who can't see that will  deserve all theyget...

1. I doubt if they are even close in terms of a naive implementation.
   As the original implemenetor of boxes arrays on SHARP APL, and 
   as one with at least ne appendage on the pulse of APL implementations
   around this planet, I doubt if they are close at all:
     a. SAPL stuff tends to work on the underlying primitive without 
        bothering to call a function to bust it up, in common rank
        and similar expressions. Oddball ones, which are rarely used,
        such as reshape with a left argument rank specification, ARE
        done in a brute force manner. At least, they were when I worked
        there, and I sorta soubt, but cannot prove, that things have changed
        in that area.
     b. A lot of the functions with rank can be implemented by either 
        introducing another level of looping, or altering the extant
        loop structure, in a rather obvious fashion:pass the rank
         expression to the primitive as Yey-Another_argument. 
        It's not clear to me how this would work with apl2 and the world
        of eachness.

2. Beata hell outa me what (2) was. Perhaps the tail end of 1b?

3. A lot of the stuff with J  (or SAPL) vs APL2 is that the each/
enclose-along-axis stuff , is that a naive implementation can do MUCH
better with rank than with each/enclose with axis. Far fewer operations
involving storage management, data movement, and so on. 

In SHARP APL, we observed speedups of typcally 5-500 when primitives
included rank adverb support directly. 

   Bob
>
>A rank operator would be great to have in APL2 instead of all that function 
>with axis stuff, and a foreach adverb and depth verb would be great to have 
>in J (sometimes the way J pads out ragged results with zeroes/blanks/empty 
>boxes makes me nervous).

I also have to admit to being disturbed by J's lack of errors, both in
the padding of ragged arrays, and in the tolerance for negative elements
in index expressions. Life's tough that way...

Robert Bernecky      rbe@yrloc.ipsa.reuter.com  bernecky@itrchq.itrc.on.ca 
Snake Island Research Inc  (416) 368-6944   FAX: (416) 360-4694 
18 Fifth Street, Ward's Island
Toronto, Ontario M5J 2B9 
Canada
