Last active
August 29, 2015 14:01
-
-
Save tuturto/a46d27bac8212f552167 to your computer and use it in GitHub Desktop.
some secondᵒ magic
This file contains 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
(import [adderall.dsl [*]]) | |
(require adderall.dsl) | |
(defreader t [expr] `(, ~@expr)) | |
(defn secondᵒ [l x] | |
(fresh [r] | |
(restᵒ l r) | |
(firstᵒ r x))) | |
(run* [q] | |
(fresh (x y) | |
(appendᵒ x y ["a" "b" "c" "d"]) | |
(condᵉ | |
[(firstᵒ y "c")] | |
[(secondᵒ y "c")]) | |
(≡ #t(x y) q))) | |
;; [(['a'], ['b', 'c', 'd']), | |
;; (['a', 'b'], ['c', 'd'])] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FYI, you don't need the
#t
reader macro, you can just write(≡ (, x y) q)
.