rewrite | R Documentation |
Interface for AST rewriting
rewrite(ast, rules)
ast |
A language object. |
rules |
A list of functions, each of which is the output from 'make_rule'. |
A language object.
library(sketch)
rewrite(
ast = rlang::parse_expr("2 * (3 + pi)"),
rules = list(make_rule("pi", "Math.PI"))
)
rewrite(
ast = rlang::parse_expr("2 + pi"),
rules = list(
make_rule("pi", "Math.PI"),
make_rule("+", "Math.add")
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.