diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-05-21 06:32:01 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-05-21 06:32:01 -0700 |
commit | ecc85df1f89e968089a3ad2498bc0138a09d95a4 (patch) | |
tree | f184e4195f51f05fc8ee919f54e87bb32bb637f1 /eval.c | |
parent | 6e30b0bbaa50af7404307a723b0e189b9777aa2e (diff) | |
download | txr-ecc85df1f89e968089a3ad2498bc0138a09d95a4.tar.gz txr-ecc85df1f89e968089a3ad2498bc0138a09d95a4.tar.bz2 txr-ecc85df1f89e968089a3ad2498bc0138a09d95a4.zip |
Introduce defparm operator.
* eval.c (me_defparm): New function.
(eval_init): Register defparm.
* txr.1: Documented defparm together with defvar.
defvar documentation is revised.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -1950,6 +1950,23 @@ static val op_prof(val form, val env) nao); } +static val me_defparm(val form, val menv) +{ + val args = rest(form); + val op = first(form); + val sym = first(args); + val initform = second(args); + + (void) menv; + + if (length(args) != two) + eval_error(form, lit("~s: two arguments expected"), op, nao); + + return list(prog1_s, + cons(defvar_s, cons(sym, nil)), + list(set_s, sym, initform, nao), nao); +} + static val me_gen(val form, val menv) { (void) menv; @@ -3936,6 +3953,7 @@ void eval_init(void) reg_op(with_saved_vars_s, op_with_saved_vars); reg_op(prof_s, op_prof); + reg_mac(intern(lit("defparm"), user_package), me_defparm); reg_mac(gen_s, me_gen); reg_mac(gun_s, me_gun); reg_mac(intern(lit("delay"), user_package), me_delay); |