Fork me on GitHub
#clara
<
2016-09-03
>
flavio07:09:59

hello all, I am experimenting with accumulators and face following problem where I would need your expertise. I have following rule: (def oldest-person (acc/max :age :returns-fact true)) (defrule get-oldest-person [?senile-person <- oldest-person :from [Person (= ?name name)]] => (println (str "The oldest person is aged " (.getAge ?senile-person) ". The person's name is " ?name)) ) The Person fact is a java bean. The accumulator doesn't seem to do anything with the :age variable, as the output is not accumulated: The oldest person is aged 50. The person's name is Person 3 The oldest person is aged 150. The person's name is Person 4 The oldest person is aged 200. The person's name is Person 1 The oldest person is aged 100. The person's name is Person 2 I suspect I am not passing the right variable binding to the accumulator, but I am not sure what to change. (.getAge) instead of :age throws an exception when compiling. Thanks for any pointers.