[erlang-questions] String to Function
Mon Dec 18 11:51:05 CET 2006
On 12/18/06, Bob Cowdery <Bob.Cowdery@REDACTED> wrote:
> Is there some way to call a function from a string or atom representation, i.e. to call it indirectly when the code does not know at compile time what function will be called.
If for example
M = lists,
F = seq,
you can write
apply(M, F, [1, 5])
The latter is quite expensive and should only be used when the number
of arguments isn't known at compile time.
More information about the erlang-questions