Created
June 26, 2014 12:07
-
-
Save lnicola/13ecb0d75f155c9293fe 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
| import Data.List | |
| ev s = map (\x -> (x, elemIndices x s)) $ nub s | |
| unifyAux [] [] substs = Just substs | |
| unifyAux (x:xs) (y:ys) substs = if snd x == snd y then unifyAux xs ys ((fst x, fst y) : substs) else Nothing | |
| unifyAux _ _ _ = Nothing | |
| unify s1 s2 = unifyAux (ev s1) (ev s2) [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment