OO (was: Why is tcl broken?)
Harvey J. Stein
hjstein at bfr.co.il
Tue Jun 15 17:46:56 EDT 1999
wtanksle at dolphin.openprojects.net (William Tanksley) writes:
> On Tue, 15 Jun 1999 01:54:53 GMT, Maxwell Sayles wrote:
> >Robin Becker wrote:
>
> >> postfix, prefix, infix etc etc are isosemantic
>
> >for myself and the others who might not know... can we get an example of
> >each?
> >and i remember someone mentioned parenthesized vs non-parenthesized...
>
> Infix (ML and Prolog):
>
> 3 + (4 minus 10) == 1
> (parenthesis are not optional)
>
> Prefix (C, Lisp, Scheme):
>
> function(that(x(1)))
> or:
> (do-this (do-that (x 1)))
> (Parenthesis are not optional)
>
> Postfix (Forth, Postscript):
>
> 3 4 + SWAP MOD do-that
> rinse on agitate 10 seconds rinse off
> (Parenthesis are not optional)
>
> As a common thread, note that in none of the languages are parenthesis
> optional. In Postfix parenthesis are not optional because they have nno
> meaning; in the other languages they're assigned arbitrary meaning.
This isn't a completely fair example. Postfix can get away without
parentheses only when a) everything that's not a number is a function
and b) the arity (# of arguments) of each function is known and fixed.
Given such restrictions one can also drop the parentheses in prefix
notation.
Infix still requires parentheses even given the above restrictions.
--
Harvey J. Stein
Bloomberg LP
hjstein at bfr.co.il
More information about the Python-list
mailing list