Fork me on GitHub
#clara
<
2016-09-05
>
wparker08:09:00

I’d surmise that you’re doing numeric comparisons on nil, though I can’t be sure without a stack trace. You probably need something like (def oldest-person (acc/max #(.getAge %) :returns-fact true)). In your original you use :age as a function, but when you look a keyword up on something that is not a Clojure map you just get nil. You can refer to fields by name in Clara rules and queries due to some special handling by Clara’s compiler, but that isn’t the case when you define accumulators, which are really just maps of keywords to Clojure functions if you take a look at what the value of oldest-person ends up being in a REPL.

flavio08:09:59

@wparker: thanks a lot for the response, this was the syntax I was looking for. I couldn't find it on the Java interop page.