Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created March 30, 2017 16:11
Show Gist options
  • Save deque-blog/18a89a6e086ae18d63c0a6839033a459 to your computer and use it in GitHub Desktop.
Save deque-blog/18a89a6e086ae18d63c0a6839033a459 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"), add({cst(2), var("x")})}),
add({cst(0), var("x")})
});
std::cout << cata<std::string>(print_infix_bad, e) << std::endl;
// Outputs =>
1 + 2 + (0) * (x) * (y) + (1) * (y) * (2 + x) + 0 + x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment