I would like to wrap a function into another which send the the result of the inner function to some external process.<br>Let say I have a function called "compute" and a log process "logger": I want to create a new function with something like:
<br><br><span style="font-family: courier new,monospace;">Log_compute = wrap_fun(compute, logger).</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
wrap_fun(Fun, Pid) -></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> fun(AllArgs) -></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
Res = Fun(AllArgs),</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> Pid ! Res</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
end.</span><br><br>But I don't know how to do that with a function of any arity (the code above work only for function of arity 1).<br>Is this do-able? if not, how should I do?<br><br>