Created
February 11, 2013 20:56
-
-
Save jennifersmith/4757548 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
(ns fbcorelogic.core | |
(:refer-clojure :exclude [==]) | |
(:use clojure.core.logic)) | |
(defn validkeyo [key] | |
(conde | |
[(emptyo key)] | |
[(fresh [first-of-key rest-of-key] | |
(resto key rest-of-key) | |
(validkeyo rest-of-key) | |
(firsto key first-of-key) | |
(membero first-of-key '(a b c d e f)))] | |
)) | |
(defn questionmarko [key scrambledkey] | |
(conde | |
[ (emptyo key) (emptyo scrambledkey)] | |
[ (fresh [ first-of-key remaining-key remaining-scrambledkey] | |
(resto key remaining-key) | |
(resto scrambledkey remaining-scrambledkey) | |
(questionmarko remaining-key remaining-scrambledkey) | |
(firsto key first-of-key) | |
(conde | |
[ (firsto scrambledkey first-of-key)] | |
[ (firsto scrambledkey '?)] | |
))])) | |
(defn -main | |
"I don't do a whole lot." | |
[& args] | |
(println "Hello, World!")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment