-2

After working function, I get a number of fact, for example: Fact 2. How can I get information about this fact programmatically?

aleator
  • 43
  • 8

1 Answers1

1
CLIPS> (clear)
CLIPS> (deftemplate person (slot name) (slot address))
CLIPS> (assert (person (name "Sam Jones") (address "123 Main Street")))
<Fact-1>
CLIPS> (assert (person (name "Sue Smith") (address "456 Maple Drive")))
<Fact-2>
CLIPS> (facts)
f-0     (initial-fact)
f-1     (person (name "Sam Jones") (address "123 Main Street"))
f-2     (person (name "Sue Smith") (address "456 Maple Drive"))
For a total of 3 facts.
CLIPS> (fact-relation 2)
person
CLIPS> (fact-slot-value 2 name)
"Sue Smith"
CLIPS> (fact-slot-value 2 address)
"456 Maple Drive"
CLIPS> 
Gary Riley
  • 10,130
  • 2
  • 19
  • 34