Joseph
Joseph

Reputation: 120

Prolog returns numbers instead of words

I'm trying to get a value returned through the variable A such as loves, however I'm getting a result like _382 instead.

Here's the query: ?- checksyn(likes,Result).

I would want Result to return loves, not _628. Is it not binding? I'm not sure.

Here's the code...

synonym(loves,[likes,adores]).
synonym(challenge,[problem]).

checksyn(X,A):-
      synonym(_,[X|_])
   ;  synonym(_,[_|X]),
      synonym(A,[X|_]),
      synonym(A,[_|X]).

Thanks in advance for any help :)

Upvotes: 0

Views: 325

Answers (0)

Related Questions