[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, srfi-41, updated. v2.0.7-207-g90fbdc1

From: Chris K. Jester-Young
Subject: [Guile-commits] GNU Guile branch, srfi-41, updated. v2.0.7-207-g90fbdc1
Date: Mon, 18 Mar 2013 16:26:31 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

The branch, srfi-41 has been updated
       via  90fbdc109e93620aeacba02507ccc02b2a2baa3b (commit)
      from  41d0789599accd3030d22fccf4884e59b85147ed (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 90fbdc109e93620aeacba02507ccc02b2a2baa3b
Author: Chris K. Jester-Young <address@hidden>
Date:   Mon Mar 18 12:21:37 2013 -0400

    Simplify stream-unfolds further, based on Mark H. Weaver's feedback.
    * module/srfi/srfi-41.scm (stream-unfolds): Don't use a promise to
      hold the result of the generator call. This means the generator
      will always get called once more than necessary, but it does make
      the code somewhat simpler, and the saved generator call probably
      wasn't worth the added code complexity.


Summary of changes:
 module/srfi/srfi-41.scm |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/module/srfi/srfi-41.scm b/module/srfi/srfi-41.scm
index fd5ec32..45b03ad 100644
--- a/module/srfi/srfi-41.scm
+++ b/module/srfi/srfi-41.scm
@@ -395,12 +395,8 @@
 (define (stream-unfolds gen seed)
   (define-stream (generator-stream seed)
-    ;; This uses delay/force, not stream-delay/stream-force, since only
-    ;; the built-in version supports multiple-value results.
-    (define promise (delay (gen seed)))
-    (stream-cons (receive (_ . items) (force promise)
-                   (list->vector items))
-                 (generator-stream (first-value (force promise)))))
+    (receive (next . items) (gen seed)
+      (stream-cons (list->vector items) (generator-stream next))))
   (define-stream (make-result-stream genstrm index)
     (define head (vector-ref (stream-car genstrm) index))
     (define-stream (tail) (make-result-stream (stream-cdr genstrm) index))

GNU Guile

reply via email to

[Prev in Thread] Current Thread [Next in Thread]