There's an inappropriate bracket that closes the rule too fast, leaving python-call :
clips.Build(""" (defrule duck (animal-is duck) => (assert (sound-is quack)) (printout t "it a duck" crlf)) (python-call addf 40 2 ) ^ """) ^ | | this one | should go here
If you want to make sure addf really returned 42, the result can be bound and printed:
clips.Build(""" (defrule duck (animal-is duck) => (assert (sound-is quack)) (printout t \"it a duck\" crlf) (bind ?tot (python-call addf 40 2 )) (printout t ?tot crlf)) """) clips.Assert("(animal-is duck)") clips.Run() t = clips.StdoutStream.Read() print t
source share