summaryrefslogtreecommitdiff
path: root/src/misc.prolog
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-04-04 01:48:43 +1100
committerJed Barber <jjbarber@y7mail.com>2014-04-04 01:48:43 +1100
commit19e66dbd8fd3bd66f286bbbcd7ce842d727a4422 (patch)
tree07f0d484b32c9792a5d18921048243d5ed924873 /src/misc.prolog
parentb2081e26122b3937f04caa62ec864fc343f83ef1 (diff)
Makefile added, files reorganised
Diffstat (limited to 'src/misc.prolog')
-rw-r--r--src/misc.prolog20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/misc.prolog b/src/misc.prolog
new file mode 100644
index 0000000..6d8ad68
--- /dev/null
+++ b/src/misc.prolog
@@ -0,0 +1,20 @@
+
+:- 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.
+