Hacker News new | ask | show | jobs
by hallgrim 731 days ago
I would disagree with this. The prefix notation isn’t hard to understand, but even if I am familiar with how it works, it still requires the reader to do conversion, whereas when I write “a + b” in most other languages, it is quite clear to anyone what it means without mental conversion.
2 comments

That's the opposite of the truth. With infix, you not only have to do conversions in your head, you need to keep track of which operator has precedence over another.

You say you make no conversion when doing `a + b`, but that's exactly equivalent to `+ a b` or `a b +`, you're simply used to a particular order. In English, adjectives normally come in front of the subject, but in many other languages, it comes after. Same thing: the order is not really very relevant and either order "works".

But where concatenative languages (and s-expression languages, e.g. Lisp) are superior is with complex expressions.

In "usual" languages, you need to convert this:

    2 * 3 + 4 - 6
to

    ((2 * 3) + 4) - 6
To clearly determine the order of operations.

In concatenative languages, you simply don't have to do anything, just apply the operators.

    * 2 3; + 4; - 6
No conversion required, just do `* 2 3`, then `+ 4 <result>`, then `- 6 <result>`.

Hence, if you really don't want to do conversions in your head, this is the way to go, not the conventional math notation!

Notice how if the expression was instead:

    2 + 3 * 4 - 6
Math notation would dictate you need to convert it to:

    (2 + (3 * 4)) - 6
That is , the order of the operations is not even the one you read it (it's not just left to right, like normal English prose, and not right-to-left either, like Arabic prose would be).

But in Cognate you MUST represent it pretty much the way you read:

    * 3 4; + 2; - 6
In your argument you fell right into the trap of confounding simplicity and familiarity.

Familiarity is when you say “look, this is like that other thing that I already do, neat”.