N
N
Nikiti42014-02-17 23:15:29
Scala
Nikiti4, 2014-02-17 23:15:29

Partial function call and currying. What is the difference?

Partial call:

def f(m: Int, n: Int) = m*n
val f3 = f(3, _:Int)
var result = f3(4)

Currying:
def f(m: Int)(n: Int) = m*n
val f3 = f(3) _
var result = f3(4)

Is there a difference in syntax, or is there some fundamental difference?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Condensed milk-chan, 2014-02-28
@Nikiti4

While partial application transforms a function with N parameters into a function with Nk parameters by applying one or more arguments, currying decomposes the function into functions of one argument while maintaining the sequence of arguments.

D
dokwork, 2015-05-01
@dokwork

there is a good explanation here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question