Scala Currying
Scala Currying
Question
Note that a and b get passed unchanged from sumInts and sumCubes into
sum.
Can we be even shorter by getting rid of these parameters?
Functions Returning Functions
sum(cube) applies sum to cube and returns the sum of cubes function.
sum(cube) is therefore equivalent to sumCubes.
This function is next applied to the arguments (1, 10).
Consecutive Stepwise Applications
sum(cube) applies sum to cube and returns the sum of cubes function.
sum(cube) is therefore equivalent to sumCubes.
This function is next applied to the arguments (1, 10).
is shown to be equivalent to
Question: Given,
Question: Given,
Note that functional types associate to the right. That is to say that
is equivalent to