Given the following function definitions:

var curry = function (f) {
               return function (x) {
                  return function (y) { return f(x,y); };
               };
};
var compose = function (f,g) {
                 return function (x) {
                    return f(g(x));
                 };
};
var g = function (x) { return 2 * x + 2; };

what is the value of the following function call?
curry( compose )( g )( function (x) { return x/2; } )( 8 )

10
  • 12
  • 11
  • 9
  • error

Is g or the anonymous function invoked first when the two functions are composed as done in this function call?

Is each function being invoked given the expected number of arguments?

Is each function being invoked given the expected type of arguments?