On Mon, Feb 23, 2009 at 5:22 PM, Joao Antunes Mourao <
[email protected]> wrote:

> Hello,
>
> /(defrule get-black-cars
>   (car (id ?id1) (color "black"))
>   (car (id ?id2 &:(~= ?id1 ?id2)) (color "black"))
>   (and (not (black-cars (car-id ?id1 ?id2)) (not (black-cars (car-id ?id2
> ?id1)))
> =>
> (assert (black-cars (car-id ?id1 ?id2)))/
>

The second CE is better written as
   (car (id ?id2 & ~?id1)) (color "black"))

>
> My question is: There is a matching way of avoid this comparison? The only
> thing i want to know is which are the black cars, not the order.
>
> You are talking of sets (in the mathematical sense). For the general case
you might consider using a java.util.Set as a (non-multi-)slot value.

-W

Reply via email to