Last active
March 15, 2018 08:08
-
-
Save milesrout/06a1e0cd01f9105136fb53ec86bceb06 to your computer and use it in GitHub Desktop.
iterators are fantastic
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
def solve(su, cs): | |
for c in cs: | |
su1 = unifies(c.t1, c.t2, c.pos) | |
su = compose_subst(su1, su) | |
return su |
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
def solve(su, cs): | |
if len(cs) == 0: | |
return su | |
[c, *cs0] = cs | |
su1 = unifies(c.t1, c.t2, c.pos) | |
return solve(compose_subst(su1, su), [c.apply(su1) for c in cs0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment