[erlang-questions] wierd list comprehension outcomes

Roelof Wobben r.wobben@REDACTED
Sun Jan 25 11:28:35 CET 2015


Hello,

I follow this book : Erlang programming and I did read chapter 2.

Now I have to do this exercise :

C. Recursive list definitions
L = [A|[2,3]].
[[3,2]|1].
[H|T] = L.

So I did this on the ERl and I saw this outcome

*  L = L = [A|[2,3]].

     [1,2,3] which is expected

* [[3,2]|1].

    * 2: syntax error before: '['  which I expected to see also [ 1 , 2 
, 3]

* [H|T] = L.

Which I see ** exception error: no match of right hand side value [1,2,3]

where I was expected to see [1] [ 2, 3]



Can someone help me figure out where my thinking took the wrong turn.

Roelof





More information about the erlang-questions mailing list