[mercury-users] Why is
pro at missioncriticalit.com
Mon Mar 5 07:03:18 AEDT 2012
On Mar 5, 2012 5:42 AM, "Jeff Thompson" <jeff at thefirst.org> wrote:
> Hello. I would like to check my understanding here. List member is
> member(X, [X | _]).
> member(X, [_ | Xs]) :- member(X, Xs).
> 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?
The in in mode doesn't bind any output variables, so it must either just
succeed or fail.
Declaratively it is irrelevant that it can succeed in two different ways.
The out in mode is nondet because it will bind output variables if it
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the users