I have a repo that parses strings of JSON and creates COOL instances that set slot values to instance names. The following defrule causes a segfault:
$ clips -f2 program.bat
#########%%%%%%%******************************************************~~~~~~~~
551 rules fired Run time is 0.00184893608093262 seconds.
298009.220373952 rules per second.
15 mean number of facts (23 maximum).
23 mean number of instances (51 maximum).
4 mean number of activations (10 maximum).
CLIPS (6.4.2 1/14/25)
CLIPS> (defrule find-asdf
?key <- (object (is-a JSON-STRING) (value "asdf"))
?member <- (object (is-a JSON-MEMBER) (key =(instance-name ?key)))
?i <- (object (is-a JSON-OBJECT) (members $? =(instance-name ?member)))
=>)
Segmentation fault (core dumped)
However, the following defrule does not cause a segfault:
$ clips -f2 program.bat
#########%%%%%%%******************************************************~~~~~~~~
551 rules fired Run time is 0.00186800956726074 seconds.
294966.36936822 rules per second.
15 mean number of facts (23 maximum).
23 mean number of instances (51 maximum).
4 mean number of activations (10 maximum).
CLIPS (6.4.2 1/14/25)
CLIPS> (defrule find-asdf
?key <- (object (is-a JSON-STRING) (value "asdf"))
?member <- (object (is-a JSON-MEMBER) (key =(instance-name ?key)))
?i <- (object (is-a JSON-OBJECT) (members $? =(instance-name ?member) $?))
=>)
CLIPS> (run)
3 rules fired Run time is 1.00135803222656e-05 seconds.
299593.142857143 rules per second.
15 mean number of facts (15 maximum).
51 mean number of instances (51 maximum).
2 mean number of activations (3 maximum).
The difference between the two is the extra $? on the end of the members slot in the last condition.
Anonymous
Checked in a fix to the 64x svn repository.