[erlang-questions] how: to serialize a function?

Tim Fletcher twoggle@REDACTED
Mon Feb 25 21:35:07 CET 2008


Given an example function like so:

    > F = fun(X) -> X * X end.

My first question is: how can I serialize (and de-serialize) that
function completely (i.e. including its args)? I know that it's easy
to send that function between processes/nodes, but how do I replicate
that serialization myself?

Next, given that I can get a string representation of the function like so:

    > erlang:fun_to_list(F).
    "#Fun<erl_eval.6.49591080>"

My second question is: what function do I use to turn that string back
into (a proper "reference" to) the function F?



More information about the erlang-questions mailing list