Is it a list ?

Zoltan Peter Toth Zoltan.Toth@REDACTED
Thu Jul 10 11:32:38 CEST 2003


Hi !

I've made a little test in the Erlang machine:

1> X = [1|2].
[1|2]

Now, my big question is, WHAT an object is X ?

2> is_list(X).
true

So, it is a list, but not a well formed one:

3> list_to_tuple(X).

=ERROR REPORT==== 10-Jul-2003::11:09:15 ===
Error in process <0.26.0> with exit value: 
{badarg,[{erlang,list_to_tuple,[[1|2]]},{erl_eval,expr,3},{erl_eval,exprs,4},{shell,eval_loop,2}]}
** exited: {badarg,[{erlang,list_to_tuple,[[1|2]]},
                     {erl_eval,expr,3},
                     {erl_eval,exprs,4},
                     {shell,eval_loop,2}]} **

9> length(X).

=ERROR REPORT==== 10-Jul-2003::11:12:42 ===
Error in process <0.39.0> with exit value: 
{badarg,[{erlang,length,[[1|2]]},{erl_eval,expr,3},{erl_eval,exprs,4},{shell,eval_loop,2}]}
** exited: {badarg,[{erlang,length,[[1|2]]},
                     {erl_eval,expr,3},
                     {erl_eval,exprs,4},
                     {shell,eval_loop,2}]} **

... so what is the structure and what are the elements and the length of this weird list ?
Thanks for any answer,
	Zoltan




More information about the erlang-questions mailing list