Wednesday, May 4, 2011

PROGRAM TO CALCULATE UNION OF 2 LISTS


gurpreet_union([X|Y],Z,W) :- member(X,Z),  gurpreet_union(Y,Z,W).
gurpreet_union([X|Y],Z,[X|W]) :- \+ member(X,Z), gurpreet_union(Y,Z,W).
gurpreet_union([],Z,Z).

No comments:

Post a Comment