Re: Re: [lsug] Tomorrow's DOJO

From: Etuka O.
Sent on: Friday, April 27, 2012 9:28 AM
I'm up for that.  I've just bought the book.

Meanwhile, I had another go at the exercise for a more Scala-ish solution than my first effort...

object Weather extends App {
  val lines = scala.io.Source.from­File("data/weather.d­at").getLines.toList­.drop(8)
  val cleanLines = lines.take(lines.len­gth - 2)
  val diffs = cleanLines.map(s => s.trim.split("""\*?\­s+""").take(3).map( _.toInt)).map(s => (s(0), s(1)-s(2)))
  println(diffs.foldLe­ft(diffs(0))( (l, r) => if(l._2 > r._2) r else l ))
 }

Our Sponsors

  • Scala Dojo

    Web site for monthly Scala Dojo

  • Scala Jobs

    Google Group of Scala Jobs in the London Area

  • _.underscore

    Scala consultants, trainers, and developers, based in London, UK

  • Springer

    Help and supporters of the monthly dojo

  • Mind Candy

    Help with the Adv Scala Meet-up

  • Skills Matter

    Provide the venue for many of our meetings.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy