Skip to main content
12 events
when toggle format what by license comment
Aug 30, 2018 at 9:36 comment added Klaws Jeppe is possibly a Smalltalk programmer. In Smalltalk, the "=" method is just another method, not different from the "-" or "|" method (the "=" tests for equality, an assignment would be ":="). Therefore, the expression would be processed strictly from left to right. You can try the code Transcript show: (37-32=5|5) printString. for your self on: tutorialspoint.com/execute_smalltalk_online.php
Aug 22, 2018 at 7:24 comment added Alex Okay, I didn't know about the precedence thing. If it weren't for that I would've liked this answer the most, even though it's unlikely that that Korean riddle book uses programming operators. But I'm upvoting anyway, because I think it's a creative answer nonetheless. :-)
Aug 20, 2018 at 12:08 comment added Alice @JeppeStigNielsen To be fair, (37 - 32 == 5) | 5 equals to true anyways. So it's still technically correct.
Aug 18, 2018 at 22:15 comment added Greg Schmit @Jeppe I get that; however the symbol actually used is =, so it looks perfectly natural from another fellow programmer :)
Aug 18, 2018 at 22:14 comment added Jeppe Stig Nielsen @GregSchmit In C, = is simple assignment which is not that relevant here. So I see the equality relation as corresponding to == in C, and == has higher precedence than |. In other words, in C, 37 - 32 = 5 | 5 makes little sense because you cannot assign to that, and 37 - 32 == 5 | 5 is legal and equivalent to (37 - 32 == 5) | 5.
Aug 18, 2018 at 21:57 comment added Greg Schmit @Jeppe, which language? In C, | has higher precedence than =.
Aug 18, 2018 at 16:02 comment added peaceoutside I initially thought of this answer by considering the divisor operator (which is also commonly displayed as a | character). However, I have never really used that operator in practice, but I use bitwise operators all the time.
Aug 18, 2018 at 10:52 comment added Jeppe Stig Nielsen I know you mean 37 - 32 = (5 | 5), but I cannot help seeing it as (37 - 32 = 5) | 5, but maybe because that is because I am used to a programming language with a particular convention for operator precedence. I like the interpretation that 5 | 5 means 5 divides 5 (evenly), better.
Aug 18, 2018 at 4:28 comment added peaceoutside Which is, of course, the best kind of correct.
Aug 18, 2018 at 2:52 comment added Facebook I have a feeling this is technically the correct answer per the move one match stick requirement.
Aug 17, 2018 at 19:40 review First posts
Aug 17, 2018 at 20:09
Aug 17, 2018 at 19:39 history answered peaceoutside CC BY-SA 4.0