Morten Kromberg wrote:
However, Mark D. Niemiec wrote:

J has abandoned a lot of the ugly and irregular archaism of APL,
making its syntax more elegant. To wit:
- bracket indexing y[x] being unlike other functions; replaced by regular x}y
- bracket syntax u[n] being unlike other operators; replaced by u"n
- irregular axis-operator semantics replaced by regular rank-operator semantics
- many APL primitives (such as rotate/reverse, compress/reduce, expand/scan)
  have two versions with different default axes. J eliminate this redundancy
  by the more general and consistent rank mechanism.
- ; having different precedence from all other verbs
- unique syntax of outer product.
- while APL has some adverb (/ \) and conjunctions (.),
  these are special-cased to only work on certain subset of primitives,
  while J allows them to be used generally.
- APL's scan operator \ is replaced by the much more useful J prefix operator,
  which can emulate scan (via /\) but the converse is not possible.
- J's tacit verb mechanism allows an entire level of elegance and
  succinct expression of functional concepts totally unheard of in APL.

J has indeed abandoned much of what one could argue is was shown to "bad" design in original APL 
(mostly in terms of making it harder to extend the language - not necessarily in terms of making the language 
easy to use). While APL systems have not abandoned anything due to the installed user base, many more modern 
alternatives are now available. J grew out of the APL community 20 years ago, and much of the bad or 
inconsistent design was well recognized at the time. Many of the fundamental ideas like rank, dual and 
"from" were designed and implemented in SHARP APL (with Ken Iverson as a driving force). So 
although much "special syntax" involving square brackets and semicolons does remain, some of the 
items on the above list is are not really fair to APL:

- In APL, indexing can be done with "squad" and "pick" indexing (no merge - yet)
- Rank was actually implemented in SHARP APL before it appeared in J. Although the APL2 
paradigm of axis specification has been dominant in the rest of the APL community, I 
think we will see rank in other APL interpreters in the future. (And for some 
expressions, the use of axis does allow slightly more elegant code than rank - even if it 
is less "general").
- It is simply not true that APL operators are limited to certain primitives, 
at least not in the APL I use. We have user-defined operators, too.

Nevertheless, APL operators are special-cased. For example:

      A {gets} 2 3 {rho} {iota} 6

      {transpose}[1] A
SYNTAX ERROR

       +/[1]A
5 7 9
      sum {gets} {+/{omega}}
      sum[1] A
SYNTAX ERROR

There is nothing wrong with the syntax in either case - even the error message is wrong.

The one really nice thing J has done that I don't see how APL can follow (due to the installed user base) it to make the first dimension the default for many operations. The interaction between this and notion of rank is really elegant.

The interaction is probably essential. Rank works well in J because it is complemented with other features that are not yet in APL - item functions, prefix agreement, tolerant assembly. Without these, rank may not have the utility that it does in J.

Dyalog APL has "Dynamic Functions" (lambda-style expressions similar in spirit to KEI's 
"Direct Definition" ideas), and they SEEM to bring us much of the practical benefits that 
tacits provide, in a less succinct, but more easily digestible form. This may be because we are 
reaching for a slightly broader programming audience, with a bit less focus on the mathematical 
aspects of the notation.

Dfns are very useful and a nice step forward, but they correspond to J's explicit definition, not tacit definition, i.e. the following are essentially the same:

   avg=: 3 : '(+/y) % #y'

and

   avg {gets} {(+/{omega}) {div} {rho}{omega}}

The only significant difference here is that the J expression is just a normal part of the language (i.e. the result of an operator expression), whereas the APL is a special syntax that treats the curly braces as a function definition.

J's tacit definitions correspond to APL's operator expressions; there are just more of them, and J also includes phrasal forms. Dyalog has already done a lot in this area, and presumably could do more.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to