[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-318-gb6e37
From: |
Chris K. Jester-Young |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-318-gb6e374e |
Date: |
Sun, 07 Apr 2013 19:27:38 +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=b6e374e535597448cb09588300d76b5d270d5d3a
The branch, stable-2.0 has been updated
via b6e374e535597448cb09588300d76b5d270d5d3a (commit)
via 3ed8d953f8d0da8ed82fe939ce48a563d7abe19b (commit)
from 7f6c3f8f0012e916469fa6c50b44c621ebdc89ac (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 b6e374e535597448cb09588300d76b5d270d5d3a
Author: Chris K. Jester-Young <address@hidden>
Date: Sun Apr 7 12:44:18 2013 -0400
Add record type printer for srfi-41.
* module/srfi/srfi-41.scm: Add record type printer for streams.
(stream-promise-visit): New helper for visiting stream promises.
commit 3ed8d953f8d0da8ed82fe939ce48a563d7abe19b
Author: Chris K. Jester-Young <address@hidden>
Date: Sun Apr 7 12:43:17 2013 -0400
Add record type printer for srfi-45.
* module/srfi/srfi-45.scm: Add record type printer for promises.
(promise-visit): New helper for visiting lazy promises.
-----------------------------------------------------------------------
Summary of changes:
module/srfi/srfi-41.scm | 23 +++++++++++++++++++++++
module/srfi/srfi-45.scm | 17 ++++++++++++++++-
2 files changed, 39 insertions(+), 1 deletions(-)
diff --git a/module/srfi/srfi-41.scm b/module/srfi/srfi-41.scm
index 6f73ce3..3589b35 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?
@@ -180,6 +181,28 @@
(define-syntax-rule (stream-lambda formals body0 body1 ...)
(lambda formals (stream-lazy (begin body0 body1 ...))))
+(define* (stream-promise-visit promise #:key on-eager on-lazy)
+ (define content (stream-promise-val promise))
+ (case (stream-value-tag content)
+ ((eager) (on-eager (stream-value-proc content)))
+ ((lazy) (on-lazy (stream-value-proc content)))))
+
+(set-record-type-printer! stream-promise
+ (lambda (strm port)
+ (display "#<stream" port)
+ (let loop ((strm strm))
+ (stream-promise-visit strm
+ #:on-eager (lambda (pare)
+ (cond ((eq? pare %stream-null)
+ (write-char #\> port))
+ (else
+ (write-char #\space port)
+ (stream-promise-visit (stream-kar pare)
+ #:on-eager (cut write <> port)
+ #:on-lazy (lambda (_) (write-char #\? port)))
+ (loop (stream-kdr pare)))))
+ #:on-lazy (lambda (_) (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..6f7ba7e 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,17 @@
;; (*) 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.
+
+(define* (promise-visit promise #:key on-eager on-lazy)
+ (define content (promise-val promise))
+ (case (value-tag content)
+ ((eager) (on-eager (value-proc content)))
+ ((lazy) (on-lazy (value-proc content)))))
+
+(set-record-type-printer! promise
+ (lambda (promise port)
+ (promise-visit promise
+ #:on-eager (lambda (value)
+ (format port "#<promise = ~s>" value))
+ #:on-lazy (lambda (proc)
+ (format port "#<promise => ~s>" proc)))))
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-318-gb6e374e,
Chris K. Jester-Young <=