Couldn’t figure out how to solve this puzzle. Anyone?
On Tue, Jul 31, 2012 at 1:53 PM, Jingjing D. [email protected]
wrote:
Couldn’t figure out how to solve this puzzle. Anyone?
The name of the puzzle is a clue; think of informal names you’ve seen
for some of the Ruby operators.
Let Ruby tell you:
Fixnum.instance_methods.find_all { |op| “X” * 2.send(op,2) == “” rescue
nil}
Then repeat for the other case, and see which operator is common to
both.
Brian C. wrote in post #1070831:
Let Ruby tell you:
Fixnum.instance_methods.find_all { |op| “X” * 2.send(op,2) == “” rescue
nil}Then repeat for the other case, and see which operator is common to
both.
Good trick. Forgot the spaceship operator returns an integer instead of
a boolean…
On Tue, Jul 31, 2012 at 6:49 PM, Jingjing D. [email protected]
wrote:
Forgot the spaceship operator returns an integer instead of
a boolean…
Booleans don’t have enough values. It has to have something for
greater, less, and equal… and despite repeated appearances on The
Daily WTF (http://thedailywtf.com), FILE_NOT_FOUND is not a valid
Boolean.
-Dave