Remix.run Logo
antonvs 18 hours ago

It’s a tradeoff against lots of irritating silly parentheses.

Someone 17 hours ago | parent | next [-]

Postfix doesn’t need parentheses.

Prefix technically doesn’t need, either, if you avoid functions taking variable number of arguments and have a grammar that can reliably detect function calls (could be hard if you’re allowing higher-order functions)

Even with functions taking a variable number of arguments, you could do it the C way and use the argc, argv trick, giving you

  * 2 + 3 5 6 7 3  ⇒  (* (+ 5 6 7) 3)  ⇒  54
I think you’d have to be a bit of a masochist to do that, though.

That also is why I think varargs functions tend to be rare in bare bones forths. You’d have to write

  5 6 7 3 + 3 2 *
Using custom names for the varargs functions would help for the 2-argument version.
lioeters 18 hours ago | parent | prev [-]

Hence Forth.

WolfeReader 13 hours ago | parent [-]

claps