Question: Consider the definition of the partial function application seen on the lecture notes: def partiall[A,B,C](a: A, f: (A,B) => C): B => C = b
Consider the definition of the partial function application seen on the lecture notes: def partiall[A,B,C](a: A, f: (A,B) => C): B => C = b => f(a, b) and this function that formats nicely a message to be displayed: def formatString[T](txt: String, x: T) txt.format(x) What expression for variable formatResult that uses partial function application returns a function of one variable that can be used to create Strings like "the result is 42" when applied as followed ? val formatResult - 1/ what comes here? printin(formatResult(42)) // displays "the result is 42" ... O partiall{(x: Int) -> "the result is %d".format(x)) O partial1(formatString, "the result is %d") O partial1("the result is %d", formatString) partial1("the result is %d", 42)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
