Write a Prolog program to implement memb(X, L): to check whether X is a member of L or not.

10. Write a Prolog program to implement memb(X, L): to check whether X is a member of L or not.

% Write a Prolog program to implement memb(X, L): to check whether
  X is a member of L or not.

%  below memb function is not predefined you can use any name as function

memb(X, [X|Tail]).
memb(X, [Head|Tail]):- memb(X, Tail).


% Output


No comments:

Post a Comment

Featured post

Amazon Interview Process

On July 5, 1994, Jeff Bezos started the world's most "customer-centric" firm out of his garage in Bellevue, Washington. The A...