[erlang-bugs] Match error when mapping a list of maps with anonymous functions in the shell

José Valim jose.valim@REDACTED
Mon Apr 28 10:59:59 CEST 2014


Hello folks,

I've found a weird bug. I will just paste my shell contents because I
cannot explain it:

    1> lists:map(fun(X) -> X#{price := 0} end, [#{hello => 0, price =>
nil}]).
    ** exception error: no match of right hand side value #{hello =>
0,price => nil}
         in function  erl_eval:expr/5 (erl_eval.erl, line 248)
         in call from lists:map/2 (lists.erl, line 1237)
    2> (fun(X) -> X#{price := 0} end)(#{hello => 0, price => nil}).
    #{hello => 0,price => 0}

Snippet also available here:
https://gist.github.com/josevalim/02cd7214d3173c5c73bc

The first expression was not supposed to fail at all. This also fails only
in the shell, the same snippet inside an .erl file works fine™.

Using Erlang 17.0 on Mac OS X.

Thank you!

*José Valim*
www.plataformatec.com.br
Skype: jv.ptec
Founder and Lead Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140428/fed9daef/attachment.htm>


More information about the erlang-bugs mailing list