Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Postfix is Reality

176 views
Skip to first unread message

Wolf Wejgaard

unread,
Jul 14, 2015, 9:59:24 AM7/14/15
to
Why are Forth programmers so shy about postfix? E.g.: In the thread about Chuck's TEDx talk Dirk writes:

> Great to read his explanation:

>>"Lisp has a prefix notation, which would be + A B with the operator coming first. Forth is postfix notation when you have A B +."

>People complain about Forth' postfix notation, but it is interesting, that Lisp is well known despite it's prefix notation. To me that means, nobody should complain about Forth' postfix. He should take a look at Lisp.

Of course, but: Postfix runs deeper, postfix is fundamental, postfix is the way things are done in reality. In real life (as in arithmetics) you need the operands before you actually can perform the operation.

To add two numbers you write down the numbers first, then add. That is how you learned to perform the addition. Although you were trained to write 22+33, the actual calcuation was probably something like this

22
33 +
--
55

Postfix is often called unnatural, also in this group recently. Better call it 'unfamiliar'. We are educated in infix a+b , but that doesn't make it 'natural'. Nature doesn't care about our ways of operating.

Postfix describes how it is really done. Look into a kitchen. Cooks take/grip the operands (potato and knife, say), then perform the operation. Peel, shale, skin, cut, boil, roast, grill, bake, ... And so do our CPU's. Better set the operands before the operation.

To some postfix makes immediate sense in comparison to algebraic notation. We know by now how to handle 22+33; then what about 22+33*44? There are two answers, so we need additional rules: Operator priority or/and parentheses. In postfix the answer is clear without any more rules: 22 33 + 44 * or 22 33 44 * +. Simple Forth.

Forgive me if you find my message trivial. And enjoy that you got it. Postfix is Reality.
Say it loud.

Wolf Wejgaard








Syd Rumpo

unread,
Jul 14, 2015, 10:20:25 AM7/14/15
to
Not only that, but typing the operand instead of the data is normal for
humans.

2 3 * uses a look-up table.
6 3.1 * uses partial products
6.32 9.87 * uses long multiplication
6.321764 4.56372 * uses a calculator

Cheers
--
Syd

Doug Hoffman

unread,
Jul 14, 2015, 10:37:29 AM7/14/15
to
On 7/14/15 9:59 AM, Wolf Wejgaard wrote:

> Forgive me if you find my message trivial. And enjoy that you got it.
> Postfix is Reality. Say it loud.

There has been (still is?) widespread use of postfix (RPN) outside of
the Forth world. This is of course use of the Hewlett-Packard RPN
pocket calculators.

-Doug

humptydumpty

unread,
Jul 16, 2015, 5:22:04 AM7/16/15
to
> Postfix is Reality
...
And (co)operates so nice with stack!

Have a nice day,
humptydumpty

Wolf Wejgaard

unread,
Jul 18, 2015, 4:47:40 AM7/18/15
to
Words and Stack.
New words defined as a concatenation of existing words.
Simple and elegant, Forth.

BTW, isn't it actually 'concatenative notation'?
'Postfix' is the special case for mathematical operations?

Thanks,
Wolf




0 new messages