Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support field accessor syntactic sugar within accumulators that use field accessors #499

Open
EthanEChristian opened this issue May 31, 2024 · 0 comments

Comments

@EthanEChristian
Copy link
Contributor

As discussed on #498, clara supports the idea of syntactic sugar within the LHS constraints when accessing fields on both POJOs and Clojure Records.

However, the default accumulators do not expose the same contract with respect to the sugar provided. This can cause a bit of a gotcha in the sense that the user can avoid the distinction(POJO vs Record) within the constraints but must evaluate that distinction for the usage of the accumulator.

If possible I would like to extend the syntactic sugar portion of field access to all portions of the LHS if possible, such that Users need not make a distinction between the access pattern within the default accumulators.

For example, I would like the following rule:

(defrule some-java-fact-rule
  [?fact <- (acc/max #(.getValue %)) :from [MyObject]]
  =>
  (insert! ....))

to be expressible via something like:

(defrule some-java-fact-rule
  [?fact <- (acc/max value) :from [MyObject]]
  =>
  (insert! ....))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant