Reputation: 1243
I'm want to write prolog code to give me L3 that's contains L1 with out the parameters of L2 (L3 = L1\L2).
and in this code i got this problem :
Syntax error: Operator expected
for the last line of
contains(_,[]) .
contains(L1,[X|TL]) :- member( X, L1) , contains(L1,TL).
minus(L1,L2,L3) :- contains(L3,L1) , not ( contains(L3,L2) ).
thanks.
Upvotes: 0
Views: 444
Reputation: 18663
not
is (usually) not defined as an operator. You should write instead not( contains(L3,L2) )
or, better yet, use the ISO Prolog standard (\+)/1
negation control construct and write \+ ( contains(L3,L2) )
.
Upvotes: 3