Created
October 28, 2017 20:03
-
-
Save pbaille/f78360ec0d7aa73773af8158325109a7 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
| (do | |
| (require '[clojure.core.logic :as l]) | |
| (require '[clojure.core.logic.fd :as fd]) | |
| (defn zip+o [l1 l2 l3] | |
| (l/conde | |
| [(l/== () l1) (l/== () l2) (l/== () l3)] | |
| [(l/fresh [fl1 rl1 fl2 rl2 fl3 rl3] | |
| (l/conso fl1 rl1 l1) | |
| (l/conso fl2 rl2 l2) | |
| (l/conso fl3 rl3 l3) | |
| (fd/in fl1 fl2 fl3 (fd/interval 10)) | |
| (fd/+ fl1 fl2 fl3) | |
| (zip+o rl1 rl2 rl3))])) | |
| (l/run* [q] | |
| (l/fresh [a b] | |
| (l/== q {:l1 a :l2 b}) | |
| (zip+o a b [2 2])))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment