[erlang-questions] wierd list comprehension outcomes

Roelof Wobben r.wobben@REDACTED
Sun Jan 25 18:16:46 CET 2015


oke,

So [[3,2]|1] is bad because there is more then 1 item.
If I do [1 | [ 2,3] ] It would be right.

Roelof


Imants Cekusins schreef op 25-1-2015 om 14:47:
> For adding items to lists:
>
> this is bad:
> [ any() | Not_a_list ]
>
> ok:
> [ One_item | T_List ]
>
> The "T_List" must be a list - even if an empty one: [ ].
> One_item ideally is not a list: atom, number, tuple, etc
>
> for "glueing" lists together, use
> lists:append/1,2
>




More information about the erlang-questions mailing list