Fork me on GitHub
Scala ?uzzlers
  • Home
  • Archive
  • How to Contribute
  • Contact
  • About
  • Puzzlers
  • Hi There!
  • UPSTAIRS downstairs
  • Location, Location, Location
  • Now You See Me, Now You Don't
  • The Missing List
  • Arg Arrgh!
  • Captured by Closures
  • Map Comprehension
  • Init You, Init Me
  • A Case of Equality
  • If At First You Don't Succeed...
  • To Map, or Not to Map
  • Private Lives
  • Self: See 'Self'
  • One Egg or Two..?
  • Return to Me!
  • Implicitly Surprising
  • One Bound, Two to Go
  • Views From the Top
  • Count Me Now, Count Me Later
  • Information Overload
  • What's in a Name?
  • I Can Has Padding?
  • Cast Away
  • Pick an Int, Any Int!
  • Type Extortion
  • Implicit Kryptonite
  • All's Well That Folds Well
  • A Case of Strings
  • Adaptive Reasoning
  • A View to a Shill
  • Accepts Any Args
  • Set the Record Straight
  • Signs of Trouble
  • The Devil Is in the Defaults
  • Market Precedence
  • Float or Sink?
  • Stringy Conversions
  • Size It Up
  • A Listful of Dollars
  • One, Two, Skip a Few
  • Oddly Enough
  • Well, In This Case...
  • Trial and Error
  • Think of 1 Card
  • Splitting Headache
  • An Exceptional Future
  • Applied Values
  • The Branch Not Taken
  • A Result, Finally!
  • Unary Quandary
  • Heads You Win...
  • (Ex)Stream Surprise
  • A Matter of Context
  • Inference Hindrance
  • Inconstant Constants
  • For Each Step...
  • Beep Beep...Reversing
  • Reductio Ad Absurdum

A fun way to learn more about Scala

Welcome to Scala Puzzlers, the collection of Traps, Pitfalls and Corner Cases in the Scala language.

Prepare to be surprised, entertained and...well, puzzled!
What is presented here is a selection of seemingly simple examples which demonstrate that there's plenty of head-scratching left in Scala.
Let your mind be challenged by unexpected and non-intuitive behaviour and results and learn something in the process.

What is a puzzler? It should be:

  • an intentional language feature (so no bugs)
  • not just weird because the reader doesn't know Scala
  • "surprising" or "non-intuitive" to a reasonably skilled Scala developer

Choose a puzzler from the left-hand list to get started!

Get the book!

Scala Puzzlers book

In-depth explanations, workarounds and more...

Your contributions are welcomed

Scala Puzzlers is a community effort! Have a puzzler you would like to share with the rest of the Scala community? Please follow these instructions to submit your puzzler. And don't worry, you will be properly credited for your contribution!

We would love to hear from you

Any kind of feedback is appreciated, about the website but also about the puzzlers themselves. If there is something you would like to let us know, please contact us.

Copyright © 2013, Andrew Phillips and Nermin Serifovic