scalapuzzlers / scalapuzzlers.github.com

Github Pages behind scalapuzzlers.com
www.scalapuzzlers.com
161 stars 53 forks source link

Tuple.x puzzler #131

Closed demobox closed 9 years ago

demobox commented 9 years ago

Updated version of Tim van Heugten's puzzler #127.

@nermin @tbvh: What do you think? Constructing the puzzler so that myTuple.x looks logical is a bit contrived, but I think there is a little to learn here:

  1. using Java-style method invocation vs. infix notation can inadvertently affect the order of operations in an expressions
  2. Tuple2 has a "weird" value x

The second item is mainly "library trivia" and the former is quite unlikely in practice, so I'm a bit on the fence about this one. Would be interested to hear what you think.

tbvh commented 9 years ago

@demobox, I'm impressed! After I submitted my puzzle, I thought I figured these ->s out, but you use them to puzzle me again.

It took me a while to understand what it is that puzzles me the most. I think it is the evaluation order of the infix notation. Somehow I'm expecting the Point -> to take precendence over the implicit -> (1), reading from left to right.

To me, that is the puzzle, and the .x is only there to make a point ;).

1) I'm in doubt whether this complies to the unofficial rule of puzzlers.

demobox commented 9 years ago

I'm in doubt whether this complies to the unofficial rule of puzzlers

It's a bit borderline, indeed - but let's see what @nermin says ;-)

demobox commented 9 years ago

It's a bit borderline, indeed - but let's see what @nermin says ;-)

Discussed this today with Nermin; consensus is that it's a little too contrived, indeed, so closing for now.

Thanks for submitting, Tim!