Functions in data structures

Francesco Cesarini francesco@REDACTED
Mon Jun 16 23:47:24 CEST 2003


Hi Joachim,

you posed some interesting questions... If you are planing on a real 
world application, I think the best approach is to test your questions 
and ideas. Set up two erlang nodes, convert your fun to a binary and zip 
it over. Or store it in mnesia. It will give you an immediate reply, 
often faster than looking it up in the documentation. And most 
certainly, more precise. That is what is so great and easy about Erlang.

Good luck in your project,
Francesco
--
http://www.erlang-consulting.com

Joachim Durchholz wrote:

> Hi all,
>
> I've been toying with Erlang, preparing for a Real-World(TM) project, 
> and such a state provokes a specific kind of questions.
>
> Mine are related to functions in data structures (I gather that 
> Erlangese for "data structure" is "term" - is this correct?)
>
> Assume that a term contains a function. Further assume that this term 
> is converted to binary, transmitted to a different machine, and 
> converted back to an Erlang term; or assume it is stored in Mnesia and 
> later read back into Erlang. The base line is: the term is taken out 
> of the Erlang run-time system and later reconstructed.
> The question is whether the function can be called after 
> reconstructing the term, under various circumstances:
>
> 1) Does it work if the function is a named function?
> 2) Does it work if the function is a named function, but the
>    term is restored in an environment that doesn't contain
>    that function?
>    (E.g. the term is sent over the network and reconstructed
>    in an Erlang run-time that doesn't have the same sources.)
> 3) Does it work if the function is anonymous?
> 4) Does it work if the function was constructed at run-time?
>    (Most functional languages can construct functions at run-time
>    by taking a given function and filling in a parameter with
>    either a term or another function. I'm not sure that this is
>    possible in Erlang, but I sincerely hope so...)
>
> Regards,
> Jo
>
>
>





More information about the erlang-questions mailing list