This blog is highly personal, makes no attempt at being politically correct, will occasionaly offend your sensibility, and certainly does not represent the opinions of the people I work with or for.
Polish versus reverse Polish
avatar
I noticed today something very strange in the way I write things down. I use completely dual parsing methods depending on whether I write by hand or use a computer.

Say that I want to write f(B(g(s),e))

If I write by hand on a paper I will write the following sequence
f
f B
f B g s
f B g(s)
f B g(s),e
f B (g(s),e)
f(B (g(s),e))
Meaning that I add the pair of parenthesis after having written the operators and their arguments, and always from the center outwards

But if I write using a keyboard I will write
f
f()
f(B())
f(B(g()))
f(B(g(s)))
f(B(g(s),e))

This said, thinking of it, this is not so surprising in fact. The first method (when writing by hand), ensures that parenthesis are written down only when all the arguments have been written (and probably mentally checked). While the second method ensures that the parenthesis are not forgotten. The second method is totally general with me; I always write opening and ending pair of symbols together, even if I then have to use my back button to reposition the cursor. I should also mention that the second method can only be used on a computer because with text editors it is possible to put characters between previously written characters (this is not possible on a piece of paper).

I have been doing this for years, but it only became so obvious today because I have been spending the last few hours writing down proofs on paper first and then entering them into LaTeX (usually I skip the first part...)

So now where does the Polish come from ? Well, turns out that both methods are probably more natural for me than they could be for other people (I actually know very few people using method one, and none using method two) because Reverse Polish Notation is very natural for me. I used to have an RPN calculator when I was in high school and still after all that time, I still instinctively re-parse every mathematical expression I see in RPN. This said, I am sure that when I think of the meaning of the expression, just like everybody else, I mentally apply Polishly.
[ add a comment ]

Archives