Skip to content

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

@EthanEChristian

Description

@EthanEChristian

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! ....))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions