[erlang-questions] What is wrong with this list?

David King dking@REDACTED
Tue Sep 4 20:58:11 CEST 2007


> Hi.
> I have been trying this statement:
> 2> [java | python] = [1, 2, 3, 4, 5, 6].

Variable names must begin with a capital letter, like

1> [Java | Python] = [1,2,3,4,5,6].
[1,2,3,4,5,6]
2> Java.
1
3> Python.
[2,3,4,5,6]


> But I got the following error:
> =ERROR REPORT==== 4-Sep-2007::17:45:07 ===
> Error in process <0.33.0> with exit value: {{badmatch, 
> [1,2,3,4,5,6]},[{erl_eval,
> expr,3}]}
> Why?
> How to read Erlang errors? they are really obfuscated.

In that case, badmatch means that the pattern [java | python] (a list  
with an atom in the head and an atom in the tail) did not match the  
pattern [1,2,3,4,5,6] (a list with six integers and an empty list in  
the tail)




More information about the erlang-questions mailing list