We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

In the recursion exercises, I don't know how to write it without tail recursion, I wrote it like that in the fibonacci :

if(list.size < size)

list match {

case t1::t2::r => {

fibonacci((t1+t2)::t1::t2::r,size)

}

case t1::Nil=> {

fibonacci(1::t1::Nil,size)

}

case Nil => {

fibonacci(0::Nil,size)

}

}

else

list

(but it's already a tail recursion but without accumulator ... I'm not used to write non-tail recursive function ^^')

So the only difference that I have in the tailFibonacci with the first, is that I don't use list.size but the accumulator ^^

Could you give me an example of non-tail recursive fibonacci sequence, or maybe I didn't understand well the exercise ^^'

PS : in "Lambda" the sumOdd is tested as sum of even because this works :

operation(a)((x:Int) => if (x % 2 != 0) 0 else x) but not with ==

If I may, the exercise is very far from the Currying concept.

In the first example, we don't pass any function as parameter of other function and no function is returned by another function.

You will find here a very good example of the Currying concept : http://docs.scala-lang.org/...

I'm very new to Scala but I resolved these exercises just by calling functions, not passing them as parameter.

def multiply(x : Int, y: Int): Int= x*y

def multiplyByTwo(x:Int): Int = multiply(x, 2)

If I'm on the wrong way, may be you could provide me some advice.

I cannot deny that, in a goal of make thing simpler, I more explained the partial application than currying. As the notions are correlated it's a good start. Nevertheless if you want a better example on the same topic, we can just imagine that the first function is defined as:

def multiply (x: Int) (y: Int) : Int = x * y

so the second one become:

def multiplyByTwo(x: Int): Int = multiply(2)(x)

Hi,

For the part about recursion, this lecture can help (quite short) :

https://oldfashionedsoftwar...

As a full beginner to scala, I found this portion very hard to understand as explained in this playground.

kr0nd• 3 years agoif(a < b) true

else false

instead of a < b in "Implement the differents sort" task looks sad...