guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-291-g4a1cd


From: Chris K. Jester-Young
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-291-g4a1cdc9
Date: Fri, 05 Apr 2013 02:23:10 +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".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=4a1cdc9d5d643d05fa7a18febc7c12070f3ef6d9

The branch, stable-2.0 has been updated
       via  4a1cdc9d5d643d05fa7a18febc7c12070f3ef6d9 (commit)
      from  cdd3d6c9f423d5b95f05193fe3c27d50b56957e9 (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 4a1cdc9d5d643d05fa7a18febc7c12070f3ef6d9
Author: Chris K. Jester-Young <address@hidden>
Date:   Thu Apr 4 22:18:40 2013 -0400

    Add record type printers for srfi-41 and srfi-45.
    
    * module/srfi/srfi-41.scm: Add record type printer for streams.
    * module/srfi/srfi-45.scm: Add record type printer for promises.

-----------------------------------------------------------------------

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

diff --git a/module/srfi/srfi-41.scm b/module/srfi/srfi-41.scm
index edf95d7..243bd44 100644
--- a/module/srfi/srfi-41.scm
+++ b/module/srfi/srfi-41.scm
@@ -27,6 +27,7 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-8)
   #:use-module (srfi srfi-9)
+  #:use-module (srfi srfi-9 gnu)
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match)
   #:export (stream-null stream-cons stream? stream-null? stream-pair?
@@ -148,7 +149,7 @@
 
 (define stream? stream-promise?)
 
-(define %stream-null '(stream . null))
+(define %stream-null (cons 'stream 'null))
 (define stream-null (stream-eager %stream-null))
 
 (define (stream-null? obj)
@@ -180,6 +181,26 @@
 (define-syntax-rule (stream-lambda formals body0 body1 ...)
   (lambda formals (stream-lazy (begin body0 body1 ...))))
 
+(set-record-type-printer! stream-promise
+  (lambda (strm port)
+    (display "#<stream" port)
+    (let loop ((strm strm))
+      (define value (stream-promise-val strm))
+      (case (stream-value-tag value)
+        ((eager)
+         (let ((pare (stream-value-proc value)))
+           (if (eq? pare %stream-null)
+               (write-char #\> port)
+               (let* ((kar (stream-kar pare))
+                      (kar-value (stream-promise-val kar)))
+                 (write-char #\space port)
+                 (case (stream-value-tag kar-value)
+                   ((eager) (write (stream-value-proc kar-value) port))
+                   ((lazy)  (write-char #\? port)))
+                 (loop (stream-kdr pare))))))
+        ((lazy)
+         (display " ...>" port))))))
+
 ;;; Derived stream functions and macros: (streams derived)
 
 (define-syntax-rule (define-stream (name . formal) body0 body1 ...)
diff --git a/module/srfi/srfi-45.scm b/module/srfi/srfi-45.scm
index 5194770..ae08f9b 100644
--- a/module/srfi/srfi-45.scm
+++ b/module/srfi/srfi-45.scm
@@ -39,7 +39,8 @@
              eager
              promise?)
   #:replace (delay force promise?)
-  #:use-module (srfi srfi-9))
+  #:use-module (srfi srfi-9)
+  #:use-module (srfi srfi-9 gnu))
 
 (cond-expand-provide (current-module) '(srfi-45))
 
@@ -76,3 +77,8 @@
 ;; (*) These two lines re-fetch and check the original promise in case
 ;;     the first line of the let* caused it to be forced.  For an example
 ;;     where this happens, see reentrancy test 3 below.
+
+(set-record-type-printer! promise
+  (lambda (promise port)
+    (define content (promise-val promise))
+    (format port "#<~a ~s>" (value-tag content) (value-proc content))))


hooks/post-receive
-- 
GNU Guile



reply via email to

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