JJJ
JJJ

Reputation: 135

Using find fact in CLIPS

I have a fact

(is-started TRUE)

I want to find if the fact exists with

(any-factp ((?is (is-started TRUE))) TRUE)

but this gives me Missing function declaration for is-started.

How can i determine if this fact exists with any-factp?

Upvotes: 1

Views: 1624

Answers (1)

Gary Riley
Gary Riley

Reputation: 10757

The fields of an implied deftemplate fact can be accessed using the implicitly defined multifield slot named implied:

CLIPS> (assert (is-started TRUE))
<Fact-1>
CLIPS> (any-factp ((?f is-started)) TRUE)
TRUE
CLIPS> (any-factp ((?f is-started)) (eq ?f:implied (create$ TRUE)))
TRUE
CLIPS> (any-factp ((?f is-started)) (eq ?f:implied (create$)))
FALSE
CLIPS> 

Upvotes: 3

Related Questions