[erlang-questions] What's this mean:[1|1]?It's it a bug?
Ivan Uemlianin
ivan@REDACTED
Wed Jul 3 12:09:18 CEST 2013
[1|1] is an "improper list", in other words, a list that doesn't end
with an empty list []. They're valid, but not terribly safe:
1> is_list([1|1]).
true
2> length([1|1]).
** exception error: bad argument
in function length/1
called as length([1|1])
I don't know if there's any use for them.
Ivan
On 03/07/2013 11:03, 饕餮 wrote:
> One of my new teammate found that this expression can work like
> list:nth(1,[1|1]) is legal.
> And the is_list([1|1]) is true
> so what's this expression mean or it's just like some bug?
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
--
============================================================
Ivan A. Uemlianin PhD
Llaisdy
Speech Technology Research and Development
ivan@REDACTED
www.llaisdy.com
llaisdy.wordpress.com
github.com/llaisdy
www.linkedin.com/in/ivanuemlianin
festina lente
============================================================
More information about the erlang-questions
mailing list