Last active
January 29, 2017 14:32
-
-
Save deque-blog/e3255c8f1236d046e8ddf6608f47c723 to your computer and use it in GitHub Desktop.
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
auto partial_eval_alg(env const& env) | |
{ | |
return [&env] (expression_r<expression> const& e) -> expression | |
{ | |
if (auto* v = get_as_var(e)) | |
{ | |
auto it = env.find(*v); | |
if (it != env.end()) return cst(it->second); | |
return var(*v); | |
} | |
return e; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment