-
-
Save swannodette/3984315 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defrel person id) | |
(defrel task id start end duration) | |
(facts person [['A] ['B]]) | |
(facts task [[1 0 10 5] | |
[2 0 10 9] | |
[3 0 11 3]]) | |
(defne personso [q] | |
([()]) | |
([[[_ p _ _] . r]] | |
(person p) | |
(personso r))) | |
(defne time-intervalso [q lp] | |
([() _]) | |
([[[_ a _ _]] [_ b _ _]] (!= a b)) | |
([[[ta a as ae] bv . r] _] | |
(matche [bv] | |
([[tb b bs be]] | |
(!= a b) | |
(time-intervalso r bv))))) | |
; each data element => [task-id person-id start-time end-time] | |
(comment | |
(let [data [[1 (lvar) (lvar) (lvar)] | |
[2 (lvar) (lvar) (lvar)] | |
[3 (lvar) (lvar) (lvar)]]] | |
(run* [q] | |
(== q data) | |
(personso q) | |
(time-intervalso q (lvar)))) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment