diff --git a/examples/macro-generating-macro-2.ts.md b/examples/macro-generating-macro-2.ts.md new file mode 100644 index 0000000..e7b6b07 --- /dev/null +++ b/examples/macro-generating-macro-2.ts.md @@ -0,0 +1,30 @@ +## `macro-generating-macro-2.ts` + +### Status: `DONE` + +### Input Program + +```typescript +using_syntax_rules( + [capture, + capture(expr, id, body), + using_syntax_rules([id, id, expr]).rewrite(body)], +).rewrite((x) => { + const using_syntax_rules = 10; + // capture introduces a using_syntax_rules form but that is + // referentially transparent .. i.e., it doesn't care about + // what's defined in its use site. Capture always works, no + // matter where you put it. + capture(x, t, (x) => x + t); +}) +``` + +### Output Program + +```typescript +(x_5) => { + const using_syntax_rules_8 = 10; + (x_13) => x_13 + x_5; +}; +``` + diff --git a/tests/macro-generating-macro-2.ts b/tests/macro-generating-macro-2.ts new file mode 100644 index 0000000..5bd59dd --- /dev/null +++ b/tests/macro-generating-macro-2.ts @@ -0,0 +1,12 @@ +using_syntax_rules( + [capture, + capture(expr, id, body), + using_syntax_rules([id, id, expr]).rewrite(body)], +).rewrite((x) => { + const using_syntax_rules = 10; + // capture introduces a using_syntax_rules form but that is + // referentially transparent .. i.e., it doesn't care about + // what's defined in its use site. Capture always works, no + // matter where you put it. + capture(x, t, (x) => x + t); +})