Skip to content

Instantly share code, notes, and snippets.

@milesrout
Last active February 21, 2016 07:22
Show Gist options
  • Save milesrout/78c13261b547fa3537c3 to your computer and use it in GitHub Desktop.
Save milesrout/78c13261b547fa3537c3 to your computer and use it in GitHub Desktop.
def vau(ptree, env):
t1, s, t2 = ptree
fv = set.union(
t2.free_variables(),
env.free_variables())
if s is Ignore:
c, env1, _ = definiend(t1, fv)
return c.subst(evaluate(t2, concat_envs(env1, env)))
else:
x, X = make_distinct_var(fv)
c, env1, _ = definiend(t1, X)
new_env = concat_envs(env1, Environment({ s: x }), env)
return Epsilon(UnaryOperative(c.subst(
evaluate(t2, new_env))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment