Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (deffacts F1
- (multime A 1 2 3 4 5)
- (multime B 2 3 4)
- (multime R)
- (multime D)
- (lista 1 8 2 7 3 4 9 5)
- (listaPare)
- )
- (defrule R1
- (multime A $? ?x $?)
- (not(multime B $? ?x $?))
- ?a <- (multime D $?elem)
- (not (multime D $? ?x $?))
- =>
- (retract ?a)
- (assert (multime D $?elem ?x))
- )
- (defrule R2
- ?a <- (lista $?el1 ?x $?el2 ?y $?el3)
- (test (> ?x ?y))
- =>
- (retract ?a)
- (assert (lista $?el1 ?y $?el2 ?x $?el3))
- )
- (defrule R3
- ?a <- (listaPare $?el1)
- ?b <- (lista $?el2 ?x $?el3)
- (test (evenp ?x))
- =>
- (retract ?a ?b)
- (assert (listaPare $?el1 ?x))
- (assert (lista $?el2 $?el3))
- )
Advertisement
Add Comment
Please, Sign In to add comment