Submitted by TheManNamedPeterPan t3_z8c5vf in explainlikeimfive
bildramer t1_iyca5ey wrote
Reply to comment by DragonFireCK in ELI5 why we first multiply, then add by TheManNamedPeterPan
Fun fact: (with some assumptions about operators) only one of the cyclic permutations of a RPN (or PN) string is valid, so you can be sneaky and define the value of any string as the value of the only parsable-as-RPN cyclic permutation of it, leading to funny stuff like 1 + 2 - 3 = 2, 5 * 6 - 7 + 8 * 9 = 368. Another fun fact: all strings with N numbers and N-1 binary operators are valid under that scheme, such as - + 8 7 * 6 5 * * 4 3 = 169. Proofs are an exercise to the reader.
Viewing a single comment thread. View all comments