int arg = 1;
if (getNumberOfArguments() == 3) {
arg = (int)((IntegerValue)getArguments()[2].evaluateItem(context)).longValue();
}
try {
return f.curry(arg, val);
} catch (XPathException e) {
e.maybeSetLocation(this);
e.maybeSetContext(context);
throw e;
}