[uim-commit] r1821 - branches/r5rs/sigscheme/test

jun0 at freedesktop.org jun0 at freedesktop.org
Thu Oct 6 01:35:07 PDT 2005


Author: jun0
Date: 2005-10-06 01:35:03 -0700 (Thu, 06 Oct 2005)
New Revision: 1821

Modified:
   branches/r5rs/sigscheme/test/test-tail-rec.scm
Log:
Add test for the case where call-with-values calls itself as the
consumer.  The same problem will arise with any code that uses
Scm_tailcall().  I don't know how to go about this problem but to
introduce more kludge in Scm_eval(), Scm_call(), etc, which seems
unwarranted considering the rarity of this corner case.

* sigscheme/test/test-tail-rec.scm
  - (rec-call-with-values-2): New test.

Modified: branches/r5rs/sigscheme/test/test-tail-rec.scm
===================================================================
--- branches/r5rs/sigscheme/test/test-tail-rec.scm	2005-10-06 06:28:00 UTC (rev 1820)
+++ branches/r5rs/sigscheme/test/test-tail-rec.scm	2005-10-06 08:35:03 UTC (rev 1821)
@@ -680,6 +680,15 @@
           (lambda (dummy1 dummy2 n)
             (rec-call-with-values (- n 1)))))))
 
+(define rec-call-with-values-2
+  (lambda (n)
+    (letrec ((producer (lambda ()
+                         (if (zero? n)
+                             (values values (lambda () 'succeeded))
+                             (begin (set! n (- n 1))
+                                    (values producer call-with-values))))))
+      (call-with-values producer call-with-values))))
+
 (define rec-receive
   (lambda (n)
     (if (zero? n)
@@ -979,6 +988,11 @@
                'succeeded
                (rec-call-with-values explosive-count))
 
+;; call-with-values
+(assert-equal? "proper tail recursion by call-with-values (2)"
+               'succeeded
+               (rec-call-with-values-2 explosive-count))
+
 ;; receive
 (assert-equal? "proper tail recursion by receive"
                'succeeded



More information about the uim-commit mailing list