diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2013-12-17 07:15:44 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2013-12-17 07:15:44 -0800 |
commit | af791d39068b7cd231497f955c0a314a31ee8881 (patch) | |
tree | 2134a7c919a06bc5b71844e05ac547df6b40d41d /eval.c | |
parent | 0c5016a7f39a6a70018949da90f3b9737bf945de (diff) | |
download | txr-af791d39068b7cd231497f955c0a314a31ee8881.tar.gz txr-af791d39068b7cd231497f955c0a314a31ee8881.tar.bz2 txr-af791d39068b7cd231497f955c0a314a31ee8881.zip |
* eval.c (op_defvar): Fix the semantics to be similar to Common Lisp:
no effect if the variable already exists.
* txr.1: Documented defvar and lisp-parse.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -721,13 +721,10 @@ static val op_defvar(val form, val env) eval_error(form, lit("let: ~s is not a bindable sybol"), sym, nao); { - val value = eval(second(args), env, form); - val existing = gethash(top_vb, sym); - - if (existing) - set(*cdr_l(existing), value); - else + if (!gethash(top_vb, sym)) { + val value = eval(second(args), env, form); sethash(top_vb, sym, cons(sym, value)); + } } return sym; |