Skip to content

Instantly share code, notes, and snippets.

@andy1138
Created January 20, 2012 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andy1138/1648221 to your computer and use it in GitHub Desktop.
Save andy1138/1648221 to your computer and use it in GitHub Desktop.
Code Kata
http://codekata.pragprog.com/2007/01/kata_four_data_.html
Part One: Weather Data
scala> Source.fromFile("weather.dat").getLines.map( """\s+([0-9]+)""".r.findAllIn(_).toList).filter( _.length > 3 ).map( x => ( x(0).trim.toInt, x(1).trim.toInt - x(2).trim.toInt)).toList.sortBy( _._2 ).last
res51: (Int, Int) = (9,54)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment