[erlang-questions] String to Function
Mon Dec 18 12:01:50 CET 2006
Thanks very much for the prompt response, works a treat. I need the latter but it's an initialisation thing so efficiency is not an issue.
On 12/18/06, Bob Cowdery <> 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