diff --git a/fz/util.pl b/fz/util.pl new file mode 100644 index 0000000..4fcbeda --- /dev/null +++ b/fz/util.pl @@ -0,0 +1,12 @@ +% == 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). -- libgit2 0.21.2