diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-12-08 06:20:57 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-12-08 06:20:57 -0800 |
commit | 9437508fe4a99cf13a391a5d82820db7b48bfc99 (patch) | |
tree | 02861fe0883d3d4ad7bdcefe5f25b9a9276a35b5 /eval.c | |
parent | 613524fa0e2ae745666428243ab0ee7909c2a452 (diff) | |
download | txr-9437508fe4a99cf13a391a5d82820db7b48bfc99.tar.gz txr-9437508fe4a99cf13a391a5d82820db7b48bfc99.tar.bz2 txr-9437508fe4a99cf13a391a5d82820db7b48bfc99.zip |
New equot macro: expand then suppress evaluation.
* eval.c (me_equot): New static function.
(eval_init): Register equot intrinsic macro.
* txr.1: Documented equot.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -2912,6 +2912,14 @@ static val me_qquote(val form, val menv) return expand_qquote(second(form), qquote_s, unquote_s, splice_s); } +static val me_equot(val form, val menv) +{ + if (!cdr(form) || cddr(form)) + eval_error(form, lit("~s: one argument required"), car(form)); + + return rlcp(cons(quote_s, cons(expand(cadr(form), menv), nil)), form); +} + static val expand_vars(val vars, val menv, val form, val *spec_p, int seq_p) { @@ -5068,6 +5076,7 @@ void eval_init(void) reg_mac(aret_s, func_n2(me_ret_aret)); reg_mac(qquote_s, func_n2(me_qquote)); reg_mac(sys_qquote_s, func_n2(me_qquote)); + reg_mac(intern(lit("equot"), user_package), func_n2(me_equot)); reg_mac(intern(lit("pprof"), user_package), func_n2(me_pprof)); reg_mac(when_s, func_n2(me_when)); reg_mac(intern(lit("unless"), user_package), func_n2(me_unless)); |