artificial intelligence - Number equality test fails in CLIPS pattern matching? -


i have following rule in clips file:

(defrule check-final (declare (salience 12))     ?scnt <- (set-count (value ?v) (class ?c))     (test (= ?v ?*total*))     =>     (printout t ?*total* " == " ?v crlf) ) 

and following strange output:

clips>(run) 14 == 9 5 == 2 

how possible ????

pattern matching rule occurs whenever fact set-count asserted or modified. rule fired time afterwards, during call run. these 2 processes can separated in time. value of ?*v* can of course change during long period of time.

the key realize printed results reflect value of ?v the epoch during pattern matching happened, while ?*total* value when results printed. since ?*total* may have seen arbitrary changes since pattern matching, there's no guarantee equal ?v when rule fires.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -