20.Write a Program in PROLOG to implement sublist(S, L) that checks whether the list S is the sublist of list L or not. (Check for sequence or the part in the same order).
%Program in PROLOG to implement sublist(S, L)
% below subset function is not predefined you can use any name as function
subset([], L).
subset([E|Tail], [E|NTail]):-
subset(Tail, NTail).
subset([E|Tail], [D|NTail]):-
subset([E|Tail], NTail).
% Output
No comments:
Post a Comment