Prolog for beginners about logic and syntax
- by lnotik
Hello everybody. I have this question : I need to create a paradict "rightGuesses" which will get 3 arguments , each one of them is a list of letters :
1) The list of guessed letters
2) The word i have to guess
3) The letters that where guessed so far .
for example :
rightGuesses([n,o,p,q], [p,r,o,l,o,g], Ans).
will give us Ans = [p, -, o, -, o, -].
i made:
rightGuesses([],T2,[ANS])
rightGuesses([A|T1],T2,[ANS]):- (member(A,T2))=\=true , rightGuesses(T1,T2,[ _ |'-']).
rightGuesses([A|T1],T2,[ANS]):- member(A,T2), rightGuesses(T1,T2,[ _ |A]).
but i get :
ERROR: c:/users/leonid/desktop/file3.pl:5:0: Syntax error: Operator expected
Warning: c:/users/leonid/desktop/file3.pl:6:
when i trying to compile it what is my problem , and is there is a better way to do it ? thanks in advance.