I came across a strange "feature" of Jess as a result of a typing error.
It appears as though Jess uses dynamic scoping -- any variables defined in a
are visible in any functions called by the RHS of the rule.
I looked for references to this in the book and the manual but couldn't find
Is this the expected behaviour? (This is just a curiosity question.)
(deftemplate person "" (slot name) (slot age))
(person (name bill) (age 20))
(person (name will) (age 25))
(person (name dill) (age 25))
(person (name jill) (age 22)) )
?f <- (person (age ?max))
(not (person (age ?less&:(> ?less ?max))))
(deffunction my-function ()
(printout t crlf "Processing fact " (?f toString) crlf)
(printout t crlf "Max age is " ?max crlf)
(printout t crlf "Max age is " ?f.age crlf crlf) )