Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Failed to load latest commit information.
src adding a solution in scala
.gitignore adding a solution in scala adding a solution in scala
build.sbt adding a solution in scala


  • Install SBT from
  • Compile with "sbt compile"
  • Run with "sbt run"
  • Optionally run tests with "sbt test"

Note: with some minor changes this can also be converted to a standalone Scala script, but SBT makes the code easier to organize and test.


Although the point of this problem is to explore non-object oriented solutions, and Scala requires the use of objects, it does offer a few interesting twists:

  • Combinator parsing
  • Implicits (see the Int -> IntID conversion that allows the "between" operator)
  • A sealed Fruit trait with case objects (similar to algebraic data types)
  • Singleton companion objects instead of static methods
  • Immutability (not required, but vals are used exclusively over vars here)
  • Unit testing (also not required, but pleasant to work with and maintain)
Something went wrong with that request. Please try again.