Just started to work with clipspy-0.3.3 in Python 3.8.3.
When extracting facts, an inconsistency was encountered in the .facts()
enumerator.
The code below
import clips
env = clips.Environment()
env.assert_string("(value 1)")
env.assert_string("(value 2)")
env.assert_string("(value 3)")
env.assert_string("(value 4)")
env.assert_string("(value 5)")
env.assert_string("(value 6)")
env.assert_string("(value 7)")
env.assert_string("(value 8)")
env.assert_string("(value 9)")
env.assert_string("(value 10)")
for fact in env.facts():
print(fact)
Produces result
(initial-fact)
(value 1)
(value 2)
(value 3)
(value 4)
(value 5)
(value 6)
(value 7)
(value 8)
(value 9)
f-10 (value 10)
from which one can see an inconsistency in which
f-1
is dropped away from the fact string, and,f-10
is not dropped away from the fact string.Even if the above inconsistency can be solved with regular expression substitution, as follow
import re
for fact in env.facts():
print(re.sub(r'^[^(]*',r'',str(fact)))
would be nice if the string representation of facts would be returned consistently by the .facts()
enumerator in clispy
package.
This looks like a bug in clipspy
, I would suggest you to open an issue on its repository.