0

I'm using forward chaining algorithm proposed by Bratko. How can I enter arithmetic rules in prolog DB. For example I want to enter age is 35. In other words I want to enter the fact(age,35).

Thanks

remo
  • 880
  • 2
  • 14
  • 32

1 Answers1

0

Much depends on which Prolog you're using.

I think it's safe to presume the availability of assert/1, and the 'inverse' retract/1. The code you linked already uses assert/1.

Some Prolog requires the declaration of predicates to be manipulated via assert/retract:

:- dynamic fact/2.

...
  assert(fact(age, 35)),
...
  retract(fact(Kind, Value)),
  write(Kind:Value),
...
CapelliC
  • 59,646
  • 5
  • 47
  • 90
  • Thank you for your reply. You mean I can use two versions of fact (i.e. fact/1 and fact/2). It's interesting. – remo Nov 12 '12 at 09:28