Skip to content

Instantly share code, notes, and snippets.

@k-payl
Created October 1, 2013 05:58
Show Gist options
  • Save k-payl/6774407 to your computer and use it in GitHub Desktop.
Save k-payl/6774407 to your computer and use it in GitHub Desktop.
comp(El1, El2, CompFunc) :- call(CompFunc, El1, El2).
filterOdd([], []).
filterOdd([H|T], Akk) :- nechetn(H), !, filterOdd(T, Akk1), Akk = [H|Akk1].
filterOdd([_|T], Akk) :- filterOdd(T, Akk).
nechetn(X) :- X mod 2 =:= 1.
filter([], [],_).
filter([H|T], Akk, Func) :- call(Func, H), !, filter(T, Akk1, Func), Akk = [H|Akk1].
filter([_|T], Akk, Func) :- filter(T, Akk, Func).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment