On 3/4/07, John Randall <[EMAIL PROTECTED]> wrote:
Surprisingly for this sort of article, APL got off with just a slap on the
wrist (p. 13):
[quote]
A similar break with established convention was the postulation of
operators being right-associative in the language APL in 1962. x+y+z now
suddenly stood for x+(y+z), and x-y-z for x-y+z. What a treacherous
pitfall!
[/quote]
That's a rather bemusing use of the term "operator" -- especially
in the context of APL.
I'm also rather bemused about the way Wirth mixed syntactic and
semantic contexts on the same line there -- the first and third
expressions were clearly APL, and the second and fourth
expressions were clearly some other language. But even there
for the semantic equivalence expressed by Wirth to be valid,
the variables x, y and z would have to be scalars -- otherwise
the second and fourth sentences would have been invalid for any
language Wirth had available which made his syntactic point valid.
But I suppose one should never let annoying facts get in the
way of a good rant.
And there IS an actual fact that underlies Wirth's point: APL
(and related languages such as J) have a learning curve for
programmers coming from other infix languages -- even for simple
expressions involving subtraction.
That said, one of the things I really like about J is Iverson's
use of the terms "Noun", "Verb", "Adverb", "Conjunction", to
describe the grammatical character of J's ... functions. I also
like the considerably expanded role that Adverbs and
Conjunctions (what APL programmers would call "operators") have
over what they had in APL.
(I think, espeically with the n v v fork, that it should be
obvious that even nouns are functions -- granted, they are
constant functions which take an empty argument list, but that
just makes them an edge case. It is interesting to contrast J's
treatment of arrays with K's, but they are different languages
and it's completely appropriate for similar words to have
different meanings in different languages.)
And I can't imagine how you'd come up with an analogous way of
describing the grammar of an infix language such as C, or even
Pascal. Let's say that '+' is a verb, what is '*'? What is
'['? How about ';'? etc. etc. In that context, Wirth's
frustrated use of "Operator" makes a sort of sense.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm