
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

CS181: Programming Languages Vladimir Vacic, Christos Koufogiannakis University of California, Riverside
last_element([E], E). last_element([_|T], E) :- last_element(T, E).
last_earns(X, E) :- earns(Y, E), last_element(Y, X).
family_total(X, S) :- bagof(M, last_earns(X, M), L), sum(L, S).
list_min(X, [X]). list_min(X, [H|T]) :- list_min(M, T), min(M, H, X).
contains_min(L1, L2) :- member(X, L1), list_min(X, L2).