shithub: pprolog

ref: 660d7d81eb1adcc2b108d0b150e3439972b1ec0a
dir: /lists.pl/

View raw version
:- module(lists, []).

% List predicates

length([], 0).
length([_|Tail], Length) :-
	length(Tail, Length0),
	Length is Length0 + 1.

member(X, [X|_]).
member(X, [_|Tail]) :-
	member(X, Tail).

append([], Ys, Ys).
append([X|Xs], Ys, [X|Rest]) :-
	append(Xs, Ys, Rest).