How do you remove identical facts in CLIPS?
Presuming I have
(fact 2) (fact 3) (fact 2) (fact 4)
I want to remain only with (fact 2), (fact 3) and (fact 4). How can I do that?
Well I did it like this
(defrule removeduplicates
?f1 <- (fact ?number1)
?f2 <- (fact ?number2)
(test (eq ?number1 ?number2))
=>
(retract ?f1)
)