% types, predicates, sets, etc
% p(1). p(2). p(3).
% q(2). q(3).

% intersection
% r(X) :- p(X), q(X).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%

p(1). p(2). p(3).
q(2). q(3).

% always fails; explain why
empty(X) :- p(X), !, q(X).

% just first solution to p
only1(X) :- p(X), !.

% just the first intersection point
firstInt(X) :- p(X), q(X), !.

% product type of p and q 
prod(X, Y) :- p(X), q(Y).

% section/ currying / fixing first point only
r(X, Y) :- p(X), !, q(Y).