Open nicoabie opened 5 years ago
Hi, The solution provided will asset that subset([a,b,c,a], [a, b, c]). is true. It is missing checking that the first parameter is a set itself. Here I propose a fix using the set definition implemented in a previous chapter.
set([], []). set([H|T], X):- member(H, T), !, set(T, X). set([H|T], [H|X]):- set(T, X). subset_check(SS, S):- set(SS, SS), all_members(SS, S). all_members([], _). all_members([H|T], S):- member(H, S), !, all_members(T, S)
Thanks a lot for making this repository.
Hi, The solution provided will asset that subset([a,b,c,a], [a, b, c]). is true. It is missing checking that the first parameter is a set itself. Here I propose a fix using the set definition implemented in a previous chapter.
Thanks a lot for making this repository.