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: mixing it up: The role of fractional axis brackets
Message-ID: <1991Apr29.142754.17015@yrloc.ipsa.reuter.COM>
Reply-To: rbe@yrloc.ipsa.reuter.COM (Robert Bernecky)
Organization: Snake Island Research Inc, Toronto
Distribution: comp.lang.apl
Date: Mon, 29 Apr 91 14:27:54 GMT

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
