very useful macroPrint keyword

This commit is contained in:
2022-08-02 15:27:54 +00:00
parent 51cc2725d5
commit 988d4d6652

View File

@@ -493,6 +493,18 @@ class SpecialForms {
]).withMacroPosOf(wholeExp);
};
k.doc("macroPrint", 1, 1, "(macroPrint <exp...>)");
// At compile-time, print the macro expansion and generated haxe code of the given expression,
// Then at runtime, evaluate the expression normally.
map["macroPrint"] = (wholeExp:ReaderExp, exps:Array<ReaderExp>, k:KissState) -> {
var b = wholeExp.expBuilder();
Helpers.printExp(exps[0]);
var e = Kiss.convert(k, exps[0]);
Prelude.printStr(e.toString());
return e;
};
return map;
}