oracle-samples/clara-rules

:let bindings in a rule/query LHS

Opened this issue · 0 comments

In issue 373 I mentioned that there are some patterns that aren't particularly easy to support with bindings from accumulators. I decided to log a separate issue since there were too many threads going on in that issue IMO. I was envisioning something like

(defrule greatest-temp
    [?greatest <- (acc/max :temperature :returns-fact true) [Temperature]]
    :let [?greatest-loc (:location ?greatest)]
    =>
    ....
    )

It is easy to use ?greatest in the current implementation, but creating additional bindings that don't impact the way we accumulate isn't as simple. Perhaps it isn't needed... I was just brainstorming clean and intuitive ways to support such usage patterns. This would consistent with Clojure core constructs such as for, doseq, etc. and so would likely be easy for users to understand.