[erlang-questions] Function Reference to Code Tree

Tyron Zerafa tyron.zerafa@REDACTED
Tue Jan 22 18:21:17 CET 2013


F = fun(X,Y) -> X+Y end,

In the above statement, F is just a function reference. Can I get the
syntax, code tree or anything else from this variable? All I need is to
extract the syntax out of a function reference. Any ideas how I can achieve
this?

The following convert a fun string into an actual fun. I need something the
other way round, any ideas ??


{ok,Tks,_} = erl_scan:string(FunString),
{ok,E} = erl_parse:parse_exprs(Tks),
{value,Funs,_} = erl_eval:exprs(E,[])

Thanks :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130122/4279b6a3/attachment.htm>


More information about the erlang-questions mailing list