Re: Syntax, expressiveness and the beauty of Tcl



In article <454690AA.5080109@xxxxxxx>, Kevin Kenny <kennykb@xxxxxxx> wrote:
Eckhard Lehmann wrote:
That all looks very weird and complex. What about a simple and strict
polish notation, like in LISP:

proc + {a b} {expr {$a + $b}}
proc - {a b} {expr {$a - $b}}
proc * {a b} {expr {$a * $b}}
proc / {a b} {expr {$a / $b}}

set res [+ [* 7 8] [- 8 9]]
55

Every operator is a command as well and it is compatible with the rest
of Tcl (although it will be even less familiar to the majority of
programmers)

TIP #174 (http://tip.tcl.tk/174) is being voted on this week.
It provides exactly the Cambridge Polish (not RPN, the "reverse"
in RPN indicates that the operator comes *last*) notation that
you request.

I guess I understand WHY CP was a natural method (since one can define the
operators to be the equivalent of a proc), but..

As a VERY frequent unix "dc" user (started with my HP-28S), I probably use
RPN more (to find answers, as opposed to entering formulae in programs) than
infix..

<sigh>

MH
.



Relevant Pages

  • Re: Syntax, expressiveness and the beauty of Tcl
    ... polish notation, like in LISP: ... Every operator is a command as well and it is compatible with the rest ... of Tcl (although it will be even less familiar to the majority of ... It provides exactly the Cambridge Polish (not RPN, ...
    (comp.lang.tcl)
  • Re: The benefits of recursive programming
    ... > It's "forward" polish notation I think. ... > related to the Forth language. ... Forth is related to RPN ... Algebraic needs a final '='. ...
    (comp.programming)
  • Re: Calculator on list
    ... Polish notation, then they would naturally form a stack ... employed in your examples to "prefix" (RPN) forms. ...
    (comp.lang.prolog)