Does Clara support these Drools behaviors?
victorrodrigueznadq opened this issue · comments
@victorrodrigueznadq,
Clara supports Conditional negation, using the drools example as inspiration we'd arrive at a rule like:
(r/defrule not-a-bus
[:not [Bus]]
=>
(r/insert (->NoBusses)))
or
(r/defrule no-red-busses
[:not [Bus (= color "red")]]
=>
(r/insert (->NoRedBusses)))
Clara also supports the idea of exists
as well, :exists
is a syntactic sugar around a basic accumulator exists. Used something like:
(r/defrule got-bus
[:exists [Bus]]
=>
(r/insert (->BusExists)))
or
(r/defrule got-red-bus
[:exists [Bus (= color "red")]]
=>
(r/insert (->RedBusExists)))
thanks @EthanEChristian