assert - Logical OR in CLIPS - simple defrule -
i've started working in clips. i'm trying simple rule, i've got no thought how utilize logical or here. know define 2 rules (one relative-brother , other 1 relative-sister) think it's not point. rule is: relative of someone, if brother or sister.
(defrule main::siblings-relatives (is-brother ?x ?y) (test (or (is-sister ?x ?y)) => (assert (is-relative ?x ?y)) (printout t ?x " relative of " ?y crlf))
clips> (clear) clips> (defrule siblings-relatives (or (is-brother ?x ?y) (is-sister ?x ?y)) => (assert (is-relative ?x ?y)) (printout t ?x " relative of " ?y crlf)) clips> (assert (is-brother dave jim)) <fact-1> clips> (assert (is-sister jane frank)) <fact-2> clips> (run) jane relative of frank dave relative of jim clips> (facts) f-0 (initial-fact) f-1 (is-brother dave jim) f-2 (is-sister jane frank) f-3 (is-relative jane frank) f-4 (is-relative dave jim) total of 5 facts. clips>
assert rule logical clips
No comments:
Post a Comment