:- module(misc, [filter/3, head/2, tail/2]).
filter(List, Predicate, Result) :-
Test =.. [Predicate,X],
findall(X, Test, No),
subtract(List, No, Result).
head(X,[Y]) :- X = Y.
head(X,[Y|_]) :- X = Y.
tail(X,[]) :- X = [].
tail(X,[_]) :- X = [].
tail(X,[_|Y]) :- X = Y.