Awhuxlb.205
net.lang.apl
utzoo!decvax!harpo!zeppo!whuxlb!ech
Wed Apr  7 23:06:40 1982
apl parsing

       I think the hardest part of parsing APL is distinguishing
               +/[X]-Y
       from
               A[X]-Y

Obviously, rabbit!ark is talking about HUMAN, rather than MACHINE, parsing.
The typical apl typein program creates internal ("Z-code") representation
by a left-to-right (sic) scan; in this case, it is simple to associate the
bracket expression with the thing (variable, intermediate value, or operator)
immediately to its left.  I.e., by the time you "see" the -, you have either
absorbed the [...] into an operator (thus - is monadic) or into a value
(making - dyadic).

But as long as we are on the subject...my pet for the most confusing
(to a beginner, at least) aspect of apl is the large number of degenerate
objects; to someone with mathematical tendencies, it's a small price to
pay for the consistency of almost EVERYTHING, but consider:
       goto iota 0
       goto 0
       goto
Each of which looks like "go to nothing," each of which has a quite distinct
and valuable meaning!  To a more advanced apl'r, I submit that the most
common pitfall I run into is that some operators distinguish between a scalar
and a one-element vector (or higher order array), and some do not.  Even if
one is possessed of a large store of apl arcana, it is easy to fall into
the following kind of trap:
       VEC1 [ (SCALAR = VEC2) / VEC3 ] + VEC4
Quick: what is the result, assuming SCALAR appears exactly once in VEC2?
Answer: "LENGTH ERROR" -- the / operation, and hence the [], each return
a vector of length one which (in general) won't match the length of VEC4.
This particular kind of problem wouldn't be so bad except that I have
to use the kludge
       ((iota 0) rho vector_expression)
to explicitly "cast" the vector to a scalar.

By the way, I assume we're all "family" here.  I cut my teeth on apl
in '67 on an old 1051 term my dad had connected to Yorktown, and have
been a fanatic since...anybody else wanna share their favorite gripes?

=Ned Horvath=

-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <[email protected]>
of http://communication.ucsd.edu/A-News/


This Usenet Oldnews Archive
article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.

2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.