I am working with CLIPS embedded in a C program, so I have to do everything by C function calls and can't use the CLIPS command line.
Let's say I have asserted a few facts like this:
AssertString("(pizza 1)");
AssertString("(cauliflower 7)");
AssertString("(cheesecake 0)");
Obviously I do not get (let alone retain) any pointers to my facts at this point. When I want to retract a fact later by using Retract(factPtr)
, I obviously need the pointer to the fact I want to retract. So, after the lines above, how would I find the fact (cauliflower 7)
again and get a pointer to it?
Do I have to get the entire fact list by GetFactList([...])
, loop through it and compare strings? If so, how would I do that in the multifield DATA_OBJECT
this function returns? Or is there a better way?
I would be grateful for any ideas or even code examples.