Mini version of forward-chaining.rkt using syndicate/actor

This commit is contained in:
Tony Garnock-Jones 2016-06-14 04:01:54 -04:00
parent 7cc8f2cbe6
commit eac9f39169
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#lang syndicate
;; Minimal syndicate/actor variation on examples/forward-chaining.rkt.
(require syndicate/actor)
(actor (forever (assert `(parent john douglas))))
(actor (forever (assert `(parent bob john))))
(actor (forever (assert `(parent ebbon bob))))
;; This looks like an implication:
;; (parent A C) ⇒ ((ancestor A C) ∧ ((ancestor C B) ⇒ (ancestor A B)))
;;
(actor (forever (during `(parent ,$A ,$C)
(assert `(ancestor ,A ,C))
(during `(ancestor ,C ,$B)
(assert `(ancestor ,A ,B))))))
(actor (forever (on (asserted `(ancestor ,$A ,$B))
(log-info "~a is an ancestor of ~a" A B))))