Thanks David! I have tested and confirmed that you can also use the function without having to use xdmp:apply(). You can call it like any other function, as long as you pass the # of variables you define in the arity value you set when calling fn:function-lookup().