[erlang-questions] How to wrap a function of any arity
Fri Nov 17 16:46:34 CET 2006
I would like to wrap a function into another which send the the result of
the inner function to some external process.
Let say I have a function called "compute" and a log process "logger": I
want to create a new function with something like:
Log_compute = wrap_fun(compute, logger).
wrap_fun(Fun, Pid) ->
Res = Fun(AllArgs),
Pid ! Res
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).
Is this do-able? if not, how should I do?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions