Curried function

Report a typo

Write a curried form of the function f(x,y,z)=x+yy+zzz f(x, y, z) = x + y * y + z * z * z using lambda expressions. The result and x, y, z must be integer numbers.

Solution format. You may write the result in any valid formats but with ; on the end.

An example of a curried function: x -> y -> ...;

Sample Input 1:

1 1 1

Sample Output 1:

3

Sample Input 2:

2 3 4

Sample Output 2:

75
Write a program in Java 17
import java.util.Scanner;
import java.util.function.IntFunction;

// Curry it: f(x, y, z) = x + y^2 + z^3
class CurryProduct {

public static int calc(int x, int y, int z) {

IntFunction<IntFunction<IntFunction<Integer>>> f = // write your code here

return f.apply(x).apply(y).apply(z);
}

// Don't change the code below
public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

String[] values = scanner.nextLine().split(" ");

int x = Integer.parseInt(values[0]);
int y = Integer.parseInt(values[1]);
int z = Integer.parseInt(values[2]);

System.out.println(calc(x, y, z));
}
}
___

Create a free account to access the full topic