7 ms·
I was hoping the parentheses themselves would be flipped. Like this: > 1 + )2 * 3( (1 + 2) * 3
by carderne 9mo ago
I was hoping the parentheses themselves would be flipped. Like this:
> 1 + )2 * 3(
(1 + 2) * 3
- dgoldstein0 9mo agoSame. That said if you try to use that with ordinary parentheses usage it would get ambiguous as soon as you nest them
- chrisweekly 9mo agoWait, no. It makes no sense to use the same characters! An "inverted" opening parens is visually identical to a "normal" closing parens. IMHO the entire proposition is inane.
- dgoldstein0 9mo agoExactly.
- AmbroseBierce 9mo agoI think surrounding the operand would make slightly more sense, as in 1 + 2 (*) 3 as if it's a "delayed form" of the operation that it represents.
- SyzygyRhythm 9mo agoIf you do both (use flipped parentheses around the operators), it makes even more sense, and makes the parsing trivial to boot: just surround the entire expression with parentheses and parse normally. For instance: 1 + 2 )( 3 Becomes (1 + 2 )( 3) Which is actually just what the author wants. You might even want multiple, or an arbitrary numbers of external parentheses. Say we want to give the divide the least precedence, the multiply the middle, and the add the most. We could do that like: 1 + 2 )/( 3 ))(( 4 Surround it with two sets of parens and you have: ((1 + 2 )/( 3 ))(( 4)) I haven't just proved to myself this always does what you expect, though...