I am trying to understand the purpose of the distinction between funs and functions.  For instance, in the module foo let's define<br>    double(X) -> 2 * X.<br>Though double is perfectly nice function, the very natural 
<br>    lists:map(double, [1,2,3])<br>is not valid Erlang, not even inside foo. Instead one has to write <br>    lists:map(fun foo:double/1, [1,2,3]<br><br>Finding this tedious, I try another seemingly natural idea: I'll define my functions as funs.
<br>    doub = fun(X) -> 2*X end.<br><br>At first glance this seems to solve my problem, since I can write<br>    lists:map(doub, [1,2,3])<br>and things work as expected. But then I discover that I cannot export doub from foo: it is a fun, not a function.
<br><br>Well, things are what they are. Erlang simply does not have the clean syntax of scheme or Haskell with respect to passing functions as arguments. But why? Is this merely cruft, or does it serve some purpose?<br>