summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--example.pl3
-rw-r--r--stdlib.pl11
2 files changed, 11 insertions, 3 deletions
diff --git a/example.pl b/example.pl
index 3df943c..d9e4108 100644
--- a/example.pl
+++ b/example.pl
@@ -24,6 +24,3 @@ tester(A, B) :- true.
=(A,A).
-length([], zero).
-length([Head|Tail], suc(Length)) :-
- length(Tail, Length).
diff --git a/stdlib.pl b/stdlib.pl
index ecf7417..01b3e5f 100644
--- a/stdlib.pl
+++ b/stdlib.pl
@@ -55,3 +55,14 @@ A @>= B :-
A == B.
A @>= B :-
A @> B.
+
+% List predicates
+
+length([], 0).
+length([_|Tail], Length) :-
+ length(Tail, Length0),
+ Length is Length + 1.
+
+member(X, [X|_]).
+member(X, [_|Tail]) :-
+ member(X, Tail).