- What will be a type of the following function in curried form: (Int, String) => (Long, Boolean, Int) => String?
Int => (String => ((Long, Boolean, Int) => String)) or simplified Int => String => (Long, Boolean, Int) => String
- Describe the difference between a partially applied function and a partial function.
A partial function is not defined for some of the possible input values. A partially applied function has some of its parameters fixed to specific values.
- Define a signature and implement a function, uncurry, for a curried function of three arguments, A => B => C => R.
def uncurry[A,B,C,R](in: A => B => C => R): (A,B,C) => R = (a,b,c) => in(a)(b)(c)
- Implement a head-recursive function for the factorial calculation (n! = n * (n-1) * (n-2) * ... * 1.
def factorial(n: Long): Long = if (n < 2) n else n * factorial...