このディレクトリ
の索引
# I'm having some problems in prolog... again I need to make a function that receives three lists: elementsToRemove fullList nonRepeatedElements The function should be this as follows:
#
# removeRepeatedElements(elementsToRemove, fullList, nonRepeatedElements)
# where nonRepeatedElements is a list without any element that is in elementsToRemve AND fullList. Can anyone please help! Kind of desperate over here. ahah
#
重複された要素を取り除く([],[],[]).
重複された要素を取り除く(L1,[_要素|R2],[_要素|R3]) :-
重複要素(_要素,R2,L1_1,R2_2)
重複された要素を取り除く(L2,R2_2,R3)
append(L1_1,L2,L1).
重複要素(_,[],[],[]) :- !.
重複要素(A,[A|R2],[A|R3],R4) :-
重複要素(A,R2,R3,R4),!.
重複要素(A,[B|R2],R3,[B|R4]) :-
重複要素(A,R2,R3,R4).