Figure out the first name, wine, entree, and price for each person
so we represent each person as 4-ary compound term, p(Name,Wine,Entree,Price)
. There seem to be four of them, too.
Then we just write down what we are told:
wine_and_dine(People):-
length(People,4),
Ordered1 = p(_,W1,red_snapper,_),
member(Ordered1, People),
% W1 = bordeaux, but delay writing this down
% until it is defined some more
% or use freeze/2 in SWI:
freeze( W1, W1 = bordeaux),
Lynda2 = p(lynda,_,_,PL2),
Had2 = p(_,bordeaux,_,PB2),
member(Lynda2, People),
member(Had2, People),
% PL2 < PB2, % check this only when they are known; or
freeze(PL2, freeze(PB2, PL2 < PB2)),
.... etc.
do consult the Q&A on the zebra-puzzle tag.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…