[uim-commit] r2360 - branches/r5rs/sigscheme

yamaken at freedesktop.org yamaken at freedesktop.org
Sun Dec 4 07:02:07 PST 2005


Author: yamaken
Date: 2005-12-04 07:02:03 -0800 (Sun, 04 Dec 2005)
New Revision: 2360

Modified:
   branches/r5rs/sigscheme/eval.c
Log:
* sigscheme/eval.c
  - (ScmExp_let): Remove inefficient 'reverse' for named let


Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c	2005-12-04 14:57:11 UTC (rev 2359)
+++ branches/r5rs/sigscheme/eval.c	2005-12-04 15:02:03 UTC (rev 2360)
@@ -942,7 +942,6 @@
 ===========================================================================*/
 /*
  * FIXME:
- * - Remove inefficient 'reverse' for named let
  * - Write the test for the named let spec:
  *   <init>s should be evaluated in an environment where <procname> is not
  *   bound to the closure.  <procname>'s scope must not penetrate to the
@@ -960,6 +959,7 @@
     ScmObj val           = SCM_FALSE;
     ScmObj vars          = SCM_NULL;
     ScmObj vals          = SCM_NULL;
+    ScmQueue varq, valq;
     DECLARE_FUNCTION("let", SyntaxVariadicTailRec0);
 
     /*========================================================================
@@ -994,6 +994,8 @@
 
     body = args;
 
+    SCM_QUEUE_POINT_TO(varq, vars);
+    SCM_QUEUE_POINT_TO(valq, vals);
     for (; CONSP(bindings); bindings = CDR(bindings)) {
         binding = CAR(bindings);
 
@@ -1010,8 +1012,8 @@
             ERR_OBJ("invalid binding form (superfluous object)", binding);
 #endif
 
-        vars = CONS(var, vars);
-        vals = CONS(EVAL(val, env), vals);
+        SCM_QUEUE_ADD(varq, var);
+        SCM_QUEUE_ADD(valq, EVAL(val, env));
     }
 
     if (!NULLP(bindings))
@@ -1022,7 +1024,7 @@
 
     /* named let */
     if (SYMBOLP(named_let_sym)) {
-        proc = Scm_NewClosure(CONS(ScmOp_reverse(vars), body), env);
+        proc = Scm_NewClosure(CONS(vars, body), env);
         define_internal(named_let_sym, proc, env);
     }
 



More information about the uim-commit mailing list