[erlang-questions] reference a fun from its atom name

Tilman Holschuh <>
Sun Jun 17 19:40:32 CEST 2012


Did you try?

fun() -> apply(?MODULE, hello_test_, []) end. 

Cheers
- Tilman 

On 2012-06-17, at 9:11 AM, Roberto Ostinelli wrote:

> Dear list,
> 
> is it possible to reference a fun from its atom name? For instance:
> 
> 1> eunit:test({generator, fun hello_test_/0}).
> 
> -> everything is ok.
> 
> 2> FunName = 'hello_test_/0'.
> 'hello_test_/0'
> 3> eunit:test({generator, fun FunName}).
> * 1: syntax error before: '}'
> 
> Any ideas?
> 
> Thank you,
> 
> r.
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list