[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: various recent ll1 threads



Guy Steele - Sun Microsystems Labs <Guy.Steele@sun.com> writes:

> [...]
>    In the prefix notation / * - 2 3 + 4 1 + 11 3, / is separated from its
>    children by zero and seven tokens; * from its by zero and three; and
>    each of the +s and the - by zero and one, for a total of thirteen,
>    slightly more than in parenthesized infix notation.  If the order of
>    /'s children were swapped, prefix would keep the operators closer to
>    their operands than infix.
> 
> Interesting points, but contemplate
> 
>   / * - 2 3
>       + 4 1
>     + 11 3
> 
> or, with Lisp's parentheses,
> 
> 
>   (/ (* (- 2 3)
>         (+ 4 1))
>      (+ 11 3))
> 
> In this case each operator tends to be quite close to its children.
> If all you care about is "separation", then each operator is
> separated from its first child by zero tokens and from its
> second child by one token (because you scan horizontally
> over to the first child, then vertically to the second child,
> which may be some distance down but there will be no tokens
> in the way!).
> 
> This two-dimensional effect is difficult to achoeve with infix.

This is really interesting -- I've always thought that the main advantage of
the classical mathematical notation is likely to be that it allows (by virtue
of its irregularity) to build visually rich two dimensional structures, which
I assume must be more congenial to the workings of our visual system.

Although it was clear to me that this advantage doesn't transfer well into
ASCII, it didn't occur to me that it might actually loose out in this respect
to prefix (the above example also seems to demonstrate, however, that parens
are a problem -- the parenless version is definitely easier to read). Which
brings me onto the next question -- has someone come up with a more visual
prefix-based notation for math that isn't "flat", has implicit operators
(e.g. in LaTeX notation ^{2}3 rather than 3^{2}) etc.?


alex

> 
> Yes, infix may win for small expressions.  Years of experience
> have convinced me what prefix wins for large expressions.
> 
> --Guy Steele
> 
> 
>