Showing posts with label Scala. Show all posts
Showing posts with label Scala. Show all posts

Sunday, 24 March 2013

Scala Collection framework

I'm really impressed by the elegance of the collection operations of Scala. For example the following code

       val l = List(1,2,3)
        val (l1, l2) = l partition (_>1)
        println("l1 = " + l1)
        println("l2 = " + l2)

will produce:
l1 = List(2, 3)
l2 = List(1)

We can also do that with one line of code:
val (l1, l2)  = List(1,2,3) partition (_>1)

Beautyfull !

Tuesday, 5 March 2013

Scala Coding Dojo at Toulouse

I have been at a Scala coding dojo, organised by Ekito at Toulouse. It was really a lot fun and, we also learnt a lot in only 2 hours of coding withonly one computer for 9 developpers and a Test First approach !
After a small presentation done by a guy from Ekito, we start coding a Kata in Scala. The kata was a string calculator. More on Code Katas can be found here: http://katas.softwarecraftsmanship.org/post/34191185266/katacast-stringcalculator-in-scala
The idea is to start by specifying a test with Specs 2 (http://etorreborre.github.com/specs2/) and then try to implement the corresponding code in Scala.
Here's a photo from the Ekito blog entry: http://dojo-toulouse.github.com/blog/2013/03/04/coding-dojo-scala-number-2/
Thank you Ekito !