On Sat, 8 Apr 2023 Emanuel Berg wrote:
Tom Dial wrote:
Look at the use of parentheses in Lisp [...]
I have thought about that - is Lisp possible without them?
But how do you then know priority? I'm sure someone tried
to get rid of them, but how?
Its quite a few years since I had anything to do with Lisp,
and even more since I wrote my Symbolic Logic final using
parenthesis-free Polish notation (i.e., Reversed RPN).
Yes, you mean instead of
(* 1 2 (+ 1 2 3) 3)
How would that look?
That particular term, with those commutative operators (in *Reversed*
Reverse Polish Notation, ie, in Polish/Prefix Notation), is equivalent
to this:
* 1 2 3 + 1 2 3
In the general case, allowing operators of variable arity (which I
doubt were part of the logic exam) require an arity-indicating
argument, but that's simple enough, isn't it?
So your example, without commutation of the arguments, would be
*4 1 2 +3 1 2 3 3
with *4 indicating 4-nary multiplication, and +3 ternary addition.
--
Hackers are free people. They are like artists. If they are in a good
mood, they get up in the morning and begin painting their pictures.
-- Vladimir Putin