paytherent(X,[A,[B1,B2],[C1,C2],D],[A,B3,C3,D]) :- permutation(X,[A,B1,B2,C1,C2,D]), B2>B1, B1+B2 > A, B3 #= B1+B2, C2>C1, C1+C2 > B1+B2, C3 #= C1+C2, D > C1+C2.
(no subject)
Date: 2012-10-02 04:02 pm (UTC)You call it with paytherent(Pricelist,Order,RowTotals), and as always (for Prolog) pass in a _ to say you don't care about that parameter.