Maybe you wish to say that:
% multLista of empty list is 0
multLista([],0).
But than you have to add another edge case so your recursion would work:
multLista([A],A).
Solution:
% When down to one if A is member of M the result
% is empty list
function([A],M,[]):-
member(A,M).
% else A is in the result
function([A],M,[A]):-
\+member(A,M).
% when more than one, make function of tail and simply
% return L1 because H is member of M
function([H|T],M,L1):-...
The problem with the lists is that you almost always have to take the recursively!
Here is the solution:
% Edge case: 1 element turns into a list with one element
regroup([A],[[A]]).
% Every next element it cheks all the memebers of list LL1 you get from Tail and checks if their members are...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.