diff --git a/src/macro.c b/src/macro.c index f44f5812..b2df4447 100644 --- a/src/macro.c +++ b/src/macro.c @@ -637,6 +637,18 @@ pic_macro_include(pic_state *pic) return body; } +static pic_value +pic_macro_gensym(pic_state *pic) +{ + static const char skel[] = ".g"; + pic_sym uniq; + + pic_get_args(pic, ""); + + uniq = pic_gensym(pic, pic_intern_cstr(pic, skel)); + return pic_symbol_value(uniq); +} + static pic_value pic_macro_make_sc(pic_state *pic) { @@ -898,6 +910,7 @@ pic_init_macro(pic_state *pic) xh_put_int(pic->lib->senv->name, pic->sDEFINE_MACRO, pic->sDEFINE_MACRO); pic_export(pic, pic->sDEFINE_MACRO); + pic_defun(pic, "gensym", pic_macro_gensym); pic_defun(pic, "make-syntactic-closure", pic_macro_make_sc); pic_defun(pic, "identifier?", pic_macro_identifier_p); pic_defun(pic, "identifier=?", pic_macro_identifier_eq_p);