[erlang-questions] Why does this happen?

Brent McConnell emcconne@REDACTED
Sun Jun 3 04:41:39 CEST 2007

I am new to Erlang and have been playing in the shell.  I have some behavior
that seems odd when importing the lists module and wanted to ask a more
knowledgeable audience why it does this.  In the first few lines I define a
list and a function, import lists and then map the function.  I then clear
variables and start again but this time I import lists before defining the
function and it fails.  Why?

8> f().
9> X=[1,2,3,4].
10> Y=fun(Z)->Z*Z end.
11> Y(2).
12> Y(4).
13> import (lists).
14> lists:map(Y,X).
15> f().
16> import (lists).
17> X=[1,2,3,4].
18> Y=fun(Z)->Z*Z end.

=ERROR REPORT==== 3-Jun-2007::02:31:08 ===
Error in process <0.45.0> with exit value:

** exited: {badarg,[{erlang,atom_to_list,[{module,lists}]},
                    {erl_lint,'-fun_clauses/3-fun-0-',3}]} **
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070603/9c928539/attachment.htm>

More information about the erlang-questions mailing list