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

Dustin Sallings dustin@REDACTED
Tue Sep 4 21:05:13 CEST 2007


On Sep 4, 2007, at 10:42 , Lone Wolf wrote:

> I have been trying this statement:
> 2> [java | python] = [1, 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.

	I wouldn't say they're obfuscated.  This is actually a quite useful  
error.  It's showing you the value you were trying to pattern match  
against and telling you your match failed.

	Regarding your statement, it's not clear what you expect it to do.   
If you capitalize java and python (i.e. make them variables instead  
of atoms), then it'd leave you with the values 1 and [2,3,4,5,6] for  
Java and Python respectively.  Otherwise, it's just going to tell you  
that that list doesn't equal a two element list where the first  
element is the atom ``java'' and the second is the atom ``python.''

-- 
Dustin Sallings


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070904/cf28d6c6/attachment.htm>


More information about the erlang-questions mailing list