<p><br>
On Mar 5, 2012 5:42 AM, "Jeff Thompson" <<a href="mailto:jeff@thefirst.org">jeff@thefirst.org</a>> wrote:<br>
><br>
> Hello.  I would like to check my understanding here.  List member is defined as:<br>
><br>
> member(X, [X | _]).<br>
> member(X, [_ | Xs]) :- member(X, Xs).<br>
><br>
> It is counter-intuitive to me why mode member(in, in) is semidet.  If you call member(1, [1, 1]), why doesn't the code above match twice which would make this mode nondet?<br>
></p>
<p>The in in mode doesn't bind any output variables, so it must either just succeed or fail. </p>
<p>Declaratively it is irrelevant that it can succeed in two different ways.</p>
<p>The out in mode is nondet because it will bind output variables if it succeeds. </p>
<p>Pete </p>