I can define the following two functions:
def add(a: Int, b: Int, c: Int) = a + b + c
this results in
add: (a: Int, b: Int, c: Int)Int
and
val add2 = (a: Int, b: Int, c: Int) => a + b + c
this results in
add2: (Int, Int, Int) => Int = <function3>
Both of these are functions that do the exact same thing but defined in a different way, what I do not understand is if I go ahead and define a partially applied function as follows:
def a = add _
This results in
a: (Int, Int, Int) => Int = <function3>
as expected, a function that takes 3 parameters and returns an Int, but if I do
def a2 = add2 _
This results in
a2: () => (Int, Int, Int) => Int = <function0>
which seems to be a function that takes no parameters and returns a function that takes 3 Int parameters and returns an Int. Why does this happen? Can someone please explain what is going on?
thanks