<div dir="ltr">Well, as Norton said, I was just expecting a badarg to get thrown.<div>Here nothing gets thrown thus a bug gets harder to find…<br><div class="gmail_extra"><br><br><div class="gmail_quote">On 30 March 2013 11:10,  <span dir="ltr"><<a href="mailto:ok@cs.otago.ac.nz" target="_blank">ok@cs.otago.ac.nz</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">>> It's not a contradiction, as kostis noted specs are not complete<br>
>> enumerations of all possible argument types.<br>
><br>
> Well, lists:append/2 asks for a list() as a second argument. Shouldn't<br>
> it badarg when I give it 'a', as in lists:append([], a) ?<br>
<br>
</div></div>Why?<br>
Remember that the definition<br>
<div class="im"> append([X|Xs], Ys) -> [X|append(Xs, Ys)];<br>
 append([],     Ys) -> Ys.<br>
</div>is primary.  That has been around since day 1.  The spec<br>
is a very late addition indeed which is a useful apprimation<br>
of the original behaviour, and says *NOTHING* about what<br>
will happen if you violate the precondition.<br>
<br>
This definition of append is a historic one from Lisp:<br>
Welcome to Clozure Common Lisp Version 1.5-r13651  (DarwinX8632)!<br>
? (append '(a b) 'c)<br>
(A B . C)<br>
and Scheme:<br>
Gambit v4.4.3<br>
> (append '(a b) 'c)<br>
(a b . c)<br>
It's essentially the same as what's found in Prolog:<br>
?- append([a,b], c, Zs).<br>
Zs = [a, b|c].<br>
<br>
Remember, a function specification says what the result will<br>
be *IF* the arguments have a certain form, and says *NOTHING*<br>
about the behaviour of the function if they do not.<br>
<br>
<br>
</blockquote></div><br></div></div></div>