Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created January 30, 2017 10:04
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/825df2f4e3114c593636bc76fa17b5c4 to your computer and use it in GitHub Desktop.
Save deque-blog/825df2f4e3114c593636bc76fa17b5c4 to your computer and use it in GitHub Desktop.
expression e = add({
cst(1),
cst(2),
mul({cst(0), var("x"), var("y")}),
mul({cst(1), var("y"), cst(2)}),
add({cst(0), var("x")})
});
//Environment of evaluation
env full_env = {{"x", 1}, {"y", 2}};
//Evaluations
std::cout << eval(full_env, e3) << '\n';
std::cout << eval_2(full_env, e3) << '\n';
//Will output
8
8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment