[uim-commit] r1088 - branches/r5rs/sigscheme
kzk at freedesktop.org
kzk at freedesktop.org
Mon Aug 1 01:37:13 EST 2005
Author: kzk
Date: 2005-07-31 08:37:10 -0700 (Sun, 31 Jul 2005)
New Revision: 1088
Modified:
branches/r5rs/sigscheme/eval.c
Log:
* fix "letrec" behavior
* sigscheme/eval.c
- (ScmExp_letrec): do not evaluate initial value, because
ScmExp_set also evaluates the 2nd argument.
Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c 2005-07-31 15:27:53 UTC (rev 1087)
+++ branches/r5rs/sigscheme/eval.c 2005-07-31 15:37:10 UTC (rev 1088)
@@ -1055,6 +1055,8 @@
ScmObj vars = SCM_NIL;
ScmObj vals = SCM_NIL;
ScmObj binding = SCM_NIL;
+ ScmObj var = SCM_NIL;
+ ScmObj val = SCM_NIL;
/* sanity check */
if CHECK_2_ARGS(arg)
@@ -1073,15 +1075,18 @@
if (SCM_CONSP(bindings)) {
for (; !SCM_NULLP(bindings); bindings = SCM_CDR(bindings)) {
binding = SCM_CAR(bindings);
+ var = SCM_CAR(binding);
+ val = SCM_CAR(SCM_CDR(binding));
- /* first, temporally add symbol to the env*/
- vars = Scm_NewCons(SCM_CAR(binding), SCM_NIL);
- vals = Scm_NewCons(SCM_NIL, SCM_NIL);
+ /* first, temporally add symbol to the env. Initial var is #<undef> */
+ vars = Scm_NewCons(var, SCM_NIL);
+ vals = Scm_NewCons(SCM_UNDEF, SCM_NIL);
env = extend_environment(vars, vals, env);
/* then, evaluate <init> val and (set! var val) */
- ScmExp_set(Scm_NewCons(SCM_CAR(binding),
- Scm_NewCons(ScmOp_eval(SCM_CAR(SCM_CDR(binding)), env), SCM_NIL)),
+ ScmExp_set(Scm_NewCons(var,
+ Scm_NewCons(val,
+ SCM_NIL)),
&env);
}
@@ -1246,7 +1251,7 @@
/* sanity check */
if (SCM_NULLP(var))
- SigScm_Error("define : syntax error\n");
+ SigScm_ErrorObj("define : syntax error ", arg);
/*========================================================================
(define <variable> <expression>)
@@ -1298,7 +1303,7 @@
return ScmExp_define(arg, &env);
}
- SigScm_Error("define : syntax error\n");
+ SigScm_ErrorObj("define : syntax error ", arg);
return SCM_NIL;
}
More information about the uim-commit
mailing list