[erlang-bugs] Document of lists:append/2

Yoshihiro Tanaka <>
Mon Feb 10 06:48:11 CET 2014


Okay, that makes sense. Thank you.


On Sun, Feb 9, 2014 at 8:43 PM, Bob Ippolito <> wrote:

> If you assume that all functions have undefined behavior when given
> incorrectly typed inputs, it's perfectly consistent. Erlang code tends to
> assume correctly typed input because it's simpler to implement and the
> types can often be checked mechanically with tools such as dialyzer.
>
>
> On Sunday, February 9, 2014, Yoshihiro Tanaka <> wrote:
>
>> Right. I guess I'm questioning the accuracy of the document.
>>
>>
>> On Sun, Feb 9, 2014 at 7:52 PM, Siraaj Khandkar <>wrote:
>>
>>> This is just a surprising side effect of dynamic typing. To perform the
>>> append, the left list is traversed and the right is just blindly used as
>>> a tail, so it is never introspected and thus never has an opportunity to
>>> crash.
>>>
>>>
>>> On 2/9/14, 10:30 PM, Yoshihiro Tanaka wrote:
>>> > Hi,
>>> >
>>> > In the document :http://www.erlang.org/doc/man/lists.html#append-2
>>> > It says:
>>> > append(List1, List2) -> List3, List1 = List2 = List3 = [T], T = term.
>>> >
>>> > But considering the following behavior, it does not look correct:
>>> >
>>> > 1> [] ++ undef.
>>> > undef
>>> > 2> undef ++ [].
>>> > ** exception error: bad argument
>>> >      in operator  ++/2
>>> >         called as undef ++ []
>>> > 3> [a,b] ++ undef.
>>> > [a,b|undef]
>>> > 4>
>>> >
>>> >
>>> > Thoughts ?
>>> >
>>> >
>>> > Thank you
>>> > Yoshihiro
>>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140209/66058894/attachment.html>


More information about the erlang-bugs mailing list