:- module(_, [list_diff/3], [assertions, regtypes, predefres(res_steps)]). :- entry list_diff/3 : listgnd * listgnd * var. list_diff([], _L, []). list_diff([H|L1], L2, L3) :- memberchk(H, L2), !, list_diff(L1, L2, L3). list_diff([H|L1], L2, [H|L3]) :- list_diff(L1, L2, L3). memberchk(X, [X|_]) :- !. memberchk(X, [_|L]) :- memberchk(X, L).