Re: [stack] Concatenative versus Compositionality

Robbert van Dalen <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
But what about postfix notation, i.e. the operator always comes after  
the operands?

The reason that I like Joy (or any postfix language) is that  
evaluation follows naturally from syntax, and that evaluation is non- 
ambiguous.
Contrast this with infix notation: sometimes this gives you  
evaluation headaches, such as operator precedence or excessive 'lisp'  
parentheses.

I find it easy to 'run' or 'reduce' Joy programs on paper. Just  
follow some basic rules and you can do it too :)

1) scan for any operator in an expression/program/continuation
2) determine the valence (unary, binary, ternary, ....)
3) are there enough elements before the operator to match the valence?
4) and are the elements no operators?
5) if yes to 4) and 5) execute with the preceding elements
6) otherwise, scan for another operator and continue with 2)

What's your preference?:

1 2 + 3 4 + +

or

(+ (+ 1 2) (+ 3 4))

I'd rather drop the parenthesis .... thank you very much!

- Robbert
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.