On Fri, Aug 8, 2008 at 11:18 AM, Viktor Cerovski
<[EMAIL PROTECTED]> wrote:
> Raul Miller-4 wrote:
>> More specifically, I would argue that J's parser is not significantly
>> more complex than LISP's.
>>
> The argument was that if the parser parses parenthesis,
> it doesn't need to parse dyads, forks, trains, etc.

But LISP's parser parses a number of things other than
parenthesis.  So why should J's parser be disallowed
from this kind of thing?

For example, LISP's parser supports a backquote
comma quoting/expansion mechanism.

> Now let's compare ALGOL-, LISP-, and APL-like notations:
>
> 1) ALGOL-like:  a*x^p + b*y^q
>   complex parser, programmer must know precedence rules,
>   but the notation is "just like in math".

"just like in math" does not mean anything, since in
math you can define your syntax on the spot.  I remember
one course (elementary arithmetic) where every page of my
textbook introduced  new notation and new conventions.

Or, for a simpler example of this distinction, many mathematical
books would use superscripts to denote exponentiation, and
juxtaposition to denote multiplication.

> 2) LISP-like:   (+(* a(^ x p))(* b(^ y q)))
>   very simple parser, unambiguous meaning, but many parenthesis.
>
> 3) APL-like:    (a*x^p)+ b*y^q
>   simple parser; only the "right-to-left rule" to learn.
>   Expressions may be tricky to read/write for a beginner because
>   their algebra is different, like in:  a*b+c versus c+a*b,

That's one way of doing that.

One of the strengths of APL's approach is that it encourages
you to consider alternative formulations.  For example
+/(a,b)*(x,y)^p,q would achieve the same end, and if
those vectors were generally useful in another part of the
system those parenthesis would vanish.

(Also, the one set of parenthesis that this particular
example used does not seem particularly onerous.)

Or, if you want to entirely eliminate parenthesis, you
can do that in this case, because of the regularity of
the expression:
   +/*`^/a`b,x`y,:p`q

And, you can use this form to make a lispy formulation
of that expression (using monads with macros, and with
parenthesis denoting the application of each monad):
   (+/(*`^/a`b,x`y,:p`q))

But, I do not see that much is gained by taking arbitrary
language A and imposing on it philosophies extracted
from arbitrary language B.

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

Reply via email to