So, we’ve all heard of “flatmap that sh**”, right? The new, functional, hipster way of saying
You’re doing it wrong
Since we don’t really care about dogma and functional religion that much, let’s just start trolling a little (it’s so much easier anyway), with Scala code. Check out the following piece of useful Scala code, which does compile:
def C = Seq(1, 2, 3) def Windows = 0 def WAT = (C:\Windows) /* OK, we also need this */ (_)
Awesome, right? I leave it up to you to figure out what the above piece of code does.
Don’t believe it? Or don’t care about the puzzle? Here’s the solution on ScalaFiddle.
This discussion was inspired by CTMMC