tags:

views:

65

answers:

1

member(K,[a,b,c,d]) if for one of ...

What's the statement for two of ...?

+2  A: 

Just rinse and repeat:

List = [a,b,c,d],member(X,List),member(Y,List).

If you want two distinct elements then,

List = [a,b,c,d],member(X,List),member(Y,List),X \== Y.

Then wrap it up in a predicate if that's what you're after:

two_members(X,Y,List) :-
    member(X,List),
    member(Y,List),
    X \== Y.
humble coffee