intersection/3
This commit is contained in:
@@ -35,7 +35,8 @@
|
||||
flatten/2,
|
||||
max_list/2,
|
||||
min_list/2,
|
||||
numlist/3
|
||||
numlist/3,
|
||||
intersection/3
|
||||
]).
|
||||
|
||||
:- use_module(library(error),
|
||||
@@ -390,3 +391,12 @@ numlist_(L, U, [L|Ns]) :-
|
||||
numlist_(L2, U, Ns).
|
||||
|
||||
|
||||
% copied from SWI lists library.
|
||||
intersection([], _, []) :- !.
|
||||
intersection([X|T], L, Intersect) :-
|
||||
memberchk(X, L), !,
|
||||
Intersect = [X|R],
|
||||
intersection(T, L, R).
|
||||
intersection([_|T], L, R) :-
|
||||
intersection(T, L, R).
|
||||
|
||||
|
Reference in New Issue
Block a user