summaryrefslogtreecommitdiff
path: root/stdlib.pl
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib.pl')
-rw-r--r--stdlib.pl11
1 files changed, 11 insertions, 0 deletions
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).