summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--eval.c4
-rw-r--r--txr.115
3 files changed, 25 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 374343a6..f2dd353d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2012-08-30 Kaz Kylheku <kaz@kylheku.com>
+ * eval.c (eval_intrinsic): Bugfix: take the expanded form instead
+ of throwing it away.
+ (expand): Recurse into expand_place for (set ...) forms.
+
+ * txr.1: Documented eval.
+
+2012-08-30 Kaz Kylheku <kaz@kylheku.com>
+
* txr.1: Documented all functions related to hashing.
2012-08-29 Kaz Kylheku <kaz@kylheku.com>
diff --git a/eval.c b/eval.c
index 853ddb87..b51adaac 100644
--- a/eval.c
+++ b/eval.c
@@ -393,7 +393,7 @@ val interp_fun(val env, val fun, val args)
static val eval_intrinsic(val form, val env)
{
uses_or2;
- expand(form);
+ form = expand(form);
return eval(form, or2(env, make_env(nil, nil, env)), form);
}
@@ -1643,7 +1643,7 @@ val expand(val form)
if (body == body_ex)
return form;
return rlcp(cons(sym, cons(name, cons(args, body_ex))), form);
- } else if (sym == inc_s || sym == dec_s) {
+ } else if (sym == set_s || sym == inc_s || sym == dec_s) {
val place = second(form);
val inc = third(form);
val place_ex = expand_place(place);
diff --git a/txr.1 b/txr.1
index c471c2ae..4d23d53b 100644
--- a/txr.1
+++ b/txr.1
@@ -7631,6 +7631,21 @@ each list correspond to the pairs in the hash table.
.SS Function eval
+.TP
+Syntax:
+
+ (eval <form> <env>)
+
+.TP
+Description:
+
+The eval function treats the <form> object as a Lisp expression, which is
+evaluated. The side effects implied by the form are performed, and the value
+which it produces is returned. The <env> object specifies an environment for
+resolving the function and variable references encountered in the expression.
+The object nil can be specified as an environment, in which case the evaluation
+takes place in the top-level environment.
+
.SS Function chain
.SS Functions andf and orf