Converting a function with multiple parameters to curried form