Created
January 30, 2017 10:04
-
-
Save deque-blog/825df2f4e3114c593636bc76fa17b5c4 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
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