[comp.lang.apl] mixing it up: The role of fractional axis brackets

rbe@yrloc.ipsa.reuter.COM (Robert Bernecky) (04/29/91)

A recent posting suggests that the rank adverb and the  mix[.1] (etc)
sort of axis brackets are equivalent. 

It is certainly true that APL2 expressions with axis brackets can
(or ISO APL with axis brackets) can perform many of the same operations
as those expressed with the rank adverb. FOr a few examples of this,
you can read my APL88 paper (ACM SIGAPL Quote Quad, vol.18, no. 2).

However, there are two problems with axis brackets which make them inferior
to the rank adverb:

a. The syntax is anomalous: The brackets do not conform to the syntax
   of functions (verbs), nor of operators( Adverbs), nor any other
   APL object except brackets. This complicates syntax analysis, and
   makes good fodder for religious jihads.

b. The SEMANTICS of bracket axis notation is NOT defined. That is,
   there is NO place you can go and read a definition of what they
   mean. Like the caterpillar,  axis brackets mean exactly what the
   implementor meant and nothing more. \cite{alice}

   The meaning of brackets is different for EACH function to which 
   they may apply, and the only way to determine that meaning is to 
   have a reference manual by your side. FOr example (I am doing
   this from memory, so please bear with me if I screw up), the
    APL22 definition of ravel with axis allows specification of a set
   of axes in brackets, but requires that the set of axes be contiguous
   numbers. Other functions (perhaps mix or disclose?) allow any
   set, or fractional sets, etc.

   This may not sound important at first glance, but consider the
   difference between the expressions:
      apl2:   X f[k] Y
      J:      X f"k  Y

   If you do not know the definition of f (it might be user-defined!),
   you cannot tell anything about the action of brackets in APL2.
   In J, by contrast, it has a CLEAR and CONSISTENT definition, which
   applies to user-defined verbs in exactly the same way as it does
   to primitive verbs.

Why is this difference important?

a. It makes the language easier to learn and use. You don't have to
   keep running to a reference manual to learn when you can use brackets,
   and when you have to split/apply/mix with brackets instead.

b. There is LESS Language to learn: This makes it easier to teach, and
   easier to implement.

c. By removing the special cases which axis brackets represent, we end
   up with a language with simpler syntax, fewer chances to introduce
   bugs, and thereby create more reliable programs.

Bob

 
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

Edward_M_Cherlin@cup.portal.com (05/06/91)

To me, the real problem with anomalous APL constructs is that they are
not functional. This means that they cannot be used in operator
expressions, in particular, and suffer from all of the deficiencies that
functional programming is intended to remedy, in general. See my 
forthcoming paper, "Pure Functions in APL and J", APL91 conference,
Stanford, Aug. 1991, and my articles in recent issues of APL News on
J.

I include brackets (axis, subscript), diamond, and QuadFX as anomalies,
following Iverson. These are the features he felt most needed fixing, and
he has fixed them in J.

mgf@ipsaint.ipsa.reuter.COM (Gfeller, Martin) (05/07/91)

-----------Message forwarded from IPSA Mailbox-------------


no. 5166696 filed 18.58.03  mon  6 may 1991
from mgf
to   uclapl
subj Re: mixing it up: The role of fractional axis brackets
ref  5166626

Branch and assignment arrows are not functional as well. J maps them 
both to one, and calls it copula. I don't think copulas can be 
modified by adverbs, so they're not strictly functional in J either. 
But this is a hard area. /Martin


-----------------------------------------------------------
This posting is forwarded from an internal Reuters mailbox.
No statement or opinion contained herein should be taken as
being Reuters policy, or even as being approved by Reuters,
in any way.

ljdickey@watmath.waterloo.edu (L.J.Dickey) (05/07/91)

Date: Tue, 7 May 1991 13:52:26 GMT
Lines: 26

In article <1991May6.204056.26134@yrloc.ipsa.reuter.COM>
        mgf@ipsaint.ipsa.reuter.COM (Gfeller, Martin) writes:
>no. 5166696 filed 18.58.03  mon  6 may 1991
>from mgf
>subj Re: mixing it up: The role of fractional axis brackets
>
>Branch and assignment arrows are not functional as well. J maps them 
>both to one, and calls it copula. I don't think copulas can be 
>modified by adverbs, so they're not strictly functional in J either. 
>But this is a hard area. /Martin

I dont understand this, on two counts.

    (1) There are two copulas, not one:  "=."   and  "=:"  .
    (2) Order of execution of lines in a function is controlled
        by "suite", ($.), and the suite may be modified within a
        function by doing an assignment.  I wonder if this is 
	what was meant.

It is not quite right to say that branch is mapped to assignment.