title: More determinism for `memberd/2`?
body: <p>Many systems provide a pure and efficient implementation of <code>member/2</code>. In particular, no choice point is left open for:</p>
  
  <pre><code>?- member(b,[a,b]).
  true.
  </code></pre>
  
  <p>whereas, a naive implementation of <code>member/2</code> produces rather:</p>
  
  <pre><code>?- member(b,[a,b]).
  true ;
  false.
  </code></pre>
  
  <p>which is certainly correct from a declarative viewpoint, but less efficient.</p>
  
  <p>On the other hand, there are some technical problems with <code>member/2</code>. It permits redundant solutions, like in:</p>
  
  <pre><code>?- member(a,[a,a]).
  true ;
  true.
  </code></pre>
  
  <p><code>memberd/2</code> solves this problem using <a href="https://stackoverflow.com/a/27358600/772868"><code>if_/3</code></a> and <code>(=)/3</code>.</p>
  
  <pre><code>memberd(E, [X|Xs]) :-
     if_(E = X, true, memberd(E, Xs)).
  
  ?- memberd(a,[a,a]).
  true.
  </code></pre>
  
  <p>Unfortunately, this definition leaves choice points open again - producing <code>; false</code> ("leftover choicepoints") in situations where member does not:</p>
  
  <pre><code>?- memberd(X,[a,b]).
  X = a ;
  X = b ;
  false.    % BAD - to be avoided!
  
  ?- member(X,[a,b]).
  X = a ;
  X = b.
  </code></pre>
  
  <p>So my question: Is there a definition of <code>memberd/2</code> that avoids the choice point as this one above?</p>