Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :- use_module(library(lists)).
- append([], X, X).
- append([X | Y], Z, [X | W]) :- append(Y, Z, W).
- push([], X, [X]).
- push([X | Y], Z, [X | W]) :- push(Y, Z, W).
- pushFirst(X, Z, [Z | X]).
- length([], 0).
- length([H | T], N) :- length(T, N2), N is N2 + 1.
- max([X],X).
- max([X|L],X) :- max(L,M), X > M.
- max([X|L],M) :- max(L,M), X =< M.
- min([X],X).
- min([X|L],X) :- min(L,M), X < M.
- min([X|L],M) :- min(L,M), X >= M.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement