Hi again,

Can I say that _1.5 will be more efficient than _1.5a and _1.5b since
it only fires at most once per matching cycle?

Using _1.5, I would like to get the handle to the (first) fact that activates
the rule and retract it. However, I can't use 'not' since it cannot be used
to define the values of any variables! So, does it mean that I have to
resort to using either _1.5a or _1.5b which is probably less efficient?

Thanks again!

--
Regards,
Jerry

[EMAIL PROTECTED] wrote:

> _1.5a and _1.5b mean the same thing, but _1.5a will be more
> efficient. In general, function calls will have more overhead
> than direct pattern matching.
>
> _1.5 actually has a different meaning. Whereas the second two rules
> match each e5crt fact where the field is not 0, 1, or 8, the first
> rule matches the absence of any e5crt facts with the field equal to 0,
> 1, or 8. The first rule will then be activated no more than once
> simultaneously, while the other two can each be activated multiple
> times, once for each matching fact.
>
> I think Jerry Hoe wrote:
> > Hi again,
> >
> > The rules below produce the same effect. I can't decide which one to use.
> > So, can someone please points out the pros and cons of each rule? What
> > is the rule of thumb when resolving such situations? Thanks in appreciation.
> >
> > (defrule _1.5
> >   (not(e5crt ?val&:(= ?val 0)|:(= ?val 1)|:(= ?val 8)))
> >   =>
> >   (assert (result .)))
> >
> > (defrule _1.5a
> >   (e5crt  ?val&~0&~1&~8)
> >   =>
> >   (assert (result .)))
> >
> > (defrule _1.5b
> >   (e5crt ?val&:(<> ?val 0)&:(<> ?val 1)&:(<> ?val 8))
> >   =>
> >   (assert (result .)))

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to