Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active January 29, 2017 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deque-blog/e3255c8f1236d046e8ddf6608f47c723 to your computer and use it in GitHub Desktop.
Save deque-blog/e3255c8f1236d046e8ddf6608f47c723 to your computer and use it in GitHub Desktop.
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