[erlang-questions] Wrong advertised spec of lists:append/2

Karolis Petrauskas k.petrauskas@REDACTED
Thu Mar 28 14:50:19 CET 2013


Indeed, what does the 2'nd line mean?

1: 16> [a, b] ++ c.
2: [a,b|c]
3: 17> c ++ [a, b].
4: ** exception error: bad argument
5:      in operator  ++/2
6:         called as c ++ [a,b]

Karolis

On Thu, Mar 28, 2013 at 3:42 PM, Adam Rutkowski <hq@REDACTED> wrote:
>
> On 28 Mar 2013, at 14:36, Pierre Fenoll wrote:
>
>> As per the doc, the spec of lists:append/2 is ([term()], [term()]) -> [term()].
>>
>> However, a = lists:append([], a).
>
> If the spec was ([term()], term()) then maybe ;-)
> Also, the documentation (and implementation as well) clearly states it's equivalent to A ++ B.
>
> A.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list