Scala Principles in a Nutshell (Part III)

Let’s say that we have the following code in Scala (too similar to Java, btw): def isGoodEnough(inc:Int,x:Int)=x>inc; def increasePosition(inc:Int,x:Int):Int= if (isGoodEnough(inc,x)) return x+inc; else return x; def increasePositionByOne(x: Int) ={ return increasePosition(1,x); } Now we’ll transform that piece of code into something more Scala-ish 😀 First of all, in Scala Read more…

Scala Notes: Streams

In functional programming, lists are fundamental data structures, but in some cases, they can constitute a lack of performance: Streams are data structures like lists, but its tail is only evaluated by demand. The goal is to avoid computing the tail of a sequence until is needed for the evaluation Read more…