util.pl 466 Bytes
% == No, Emacs this is -*-Prolog-*- code, not what you thought... =============

% -- utility predicates -------------------------------------------------------

% -- subset (SUB, SET, REST) --------------------------------------------------
    
subset(L, L, []).
subset(S, [H|T], R) :- subset_aux(T, H, S, R).

   subset_aux(S, R, S, [R]).
   subset_aux([H|T], R1, S, [R1|R]) :- subset_aux(T, H, S, R).
   subset_aux([H|T], X, [X|S], R) :- subset_aux(T, H, S, R).