In the application we're building, we'll need rules that count facts and
act when the right number of facts have been asserted. For example, we
might want a rule that says
If we've sold 5 cars today, then pat ourselves on the back.
Two questions about rules like this:
1) We'll have to use something like (test (= 5 ?*n-cars-sold*)) in the
LHS of a rule, right? The good advice seems to be, "avoid (test) in the
LHS." Is there a better way?
2) One way to count car-sold facts is to define a query and use
(count-query-results car-sold-query). Another way is to have a rule
that increments a global whenever a car-sold is asserted. What is the
prefered way to count facts?
Thanks,
--
Richard Kasperowski
Tel: 617-576-1552, Fax: 617-576-2441
mailto:[EMAIL PROTECTED]
http://www.altisimo.com/
--------------------------------------------------------------------
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]
--------------------------------------------------------------------
- Re: JESS: Rules that count facts? Richard Kasperowski
