user1700890
user1700890

Reputation: 7730

Define operator in SWI Prolog

I am trying to define an operator in SWI Prolog.

:- op(700, xfx, and).

when I load file with above line, it returns true, but when I try p and q, I get back:

ERROR: Undefined procedure: (and)/2 (DWIM could not correct goal)

I looked through documentation, but it is very minimal.

Upvotes: 1

Views: 409

Answers (1)

Paulo Moura
Paulo Moura

Reputation: 18663

Defining the atom and as an infix operator makes a and b a syntactically valid term but doesn't define an and/2 predicate, hence the error you got.

Your question hints that you are trying to write some code for propositional logic. Is that the case?

Upvotes: 2

Related Questions