#lang syndicate/hll ;; -*- racket -*-

(actor (forever (assert `(parent john douglas))))
(actor (forever (assert `(parent bob john))))
(actor (forever (assert `(parent ebbon bob))))

(actor (forever (on (asserted `(parent ,$A ,$C))
                    (actor (until (retracted `(parent ,A ,C))
                                  (assert `(ancestor ,A ,C)))))))

(actor (forever (on (asserted `(parent ,$A ,$C))
                    (actor (until (retracted `(parent ,A ,C))
                             (on (asserted `(ancestor ,C ,$B))
                                 (actor (until (or (retracted `(parent ,A ,C))
                                                   (retracted `(ancestor ,C ,B)))
                                          (assert `(ancestor ,A ,B))))))))))
