In the function makeCall(F, args...)
, args are the required arguments of F. When F involves multiple arguments, I currently use the if-else
statement and write the makeCall
function as follows to determine the number of arguments:
makeCall(f1,sqlCol(args[0]))
, or
makeCall(f2,sqlCol(args[0]),sqlCol(args[1]))
, or
makeCall(f3,sqlCol(args[0]),sqlCol(args[1]),sqlCol(args[2]))
.
However, as the number of arguments in F increases, the script becomes lengthy due to the increasing number of if-else
statements. Is there a concise way to pass the arguments in args to the makeCall
function?
You can use the
makeUnifiedCall
function which encapsulates all input arguments into a tuple, so that you don't need to worry about the number of arguments. When passing arguments, you can initialize a tuple for args ofmakeUnifiedCall
as follows (param for example) and useappend!
to add arguments.