Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Scala Code Trollin’

DZone's Guide to

Scala Code Trollin’

· Java Zone ·
Free Resource

FlexNet Code Aware, a free scan tool for developers. Scan Java, NuGet, and NPM packages for open source security and open source license compliance issues.

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 onScalaFiddle.

This discussion was inspired by CTMMC

 Scan Java, NuGet, and NPM packages for open source security and license compliance issues. 

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}