I am wondering why the member/2
predicate of Prolog delivers multiple alternatives (via backtracking?!), if true was already unified for the output.
For example member(1, [1,2,3]).
delivers the following output:
true ;
false.
Why does member
return false after it already found out that the atom 1
is indeed a member of the list [1,2,3]
?
Even more confusing to me is the following output:
?- member(1, [1,2,3,1]).
true ;
true.
memberd/2
. – false