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-236-g41502


From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-236-g41502bd
Date: Wed, 27 Mar 2013 01:28:46 +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=41502bd00f12a6bce97484d33f5519e97a04cf2a

The branch, stable-2.0 has been updated
       via  41502bd00f12a6bce97484d33f5519e97a04cf2a (commit)
       via  d291d7990d72b5cb8a18b20e524e1c8324297e92 (commit)
       via  65ad02b96d4118970406b1474aa00bbe801aa61a (commit)
      from  59b0f9d7635ea7e272e2976ab69764a570d7f6ff (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 41502bd00f12a6bce97484d33f5519e97a04cf2a
Author: Mark H Weaver <address@hidden>
Date:   Tue Mar 26 21:25:12 2013 -0400

    Manual: xref SRFI-45 from core Delayed Evaluation section.
    
    * doc/ref/api-evaluation.texi (Delayed Evaluation): Add cross-reference
      to SRFI-45.

commit d291d7990d72b5cb8a18b20e524e1c8324297e92
Author: Mark H Weaver <address@hidden>
Date:   Tue Mar 26 21:22:11 2013 -0400

    SRFI-45: add promise? predicate.
    
    * module/srfi/srfi-45.scm (promise?): Export.
    
    * doc/ref/srfi-modules.texi (SRFI-45): Update docs.
    
    * test-suite/tests/srfi-45.test: Add test.  Add FSF copyright for 2010
      and 2013.  Add missing year to André van Tonder's copyright notice.

commit 65ad02b96d4118970406b1474aa00bbe801aa61a
Author: Mark H Weaver <address@hidden>
Date:   Tue Mar 26 21:16:26 2013 -0400

    Revert "SRFI-45: Support multiple values; add promise? predicate."
    
    This reverts commit 1d64b4edb9da4011ad06c0fab1c6225ec20b0876.

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

Summary of changes:
 doc/ref/api-evaluation.texi   |    3 +-
 doc/ref/srfi-modules.texi     |   54 ++++++++++++++++++----------------------
 module/srfi/srfi-45.scm       |   14 ++++------
 test-suite/tests/srfi-45.test |   33 -------------------------
 4 files changed, 32 insertions(+), 72 deletions(-)

diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi
index 5c932a7..c4e77a9 100644
--- a/doc/ref/api-evaluation.texi
+++ b/doc/ref/api-evaluation.texi
@@ -1067,7 +1067,8 @@ was found, or @code{#f} otherwise.  The port is rewound.
 @cindex promises
 
 Promises are a convenient way to defer a calculation until its result
-is actually needed, and to run such a calculation only once.
+is actually needed, and to run such a calculation only once.  Also
address@hidden
 
 @deffn syntax delay expr
 @rnindex delay
diff --git a/doc/ref/srfi-modules.texi b/doc/ref/srfi-modules.texi
index 347b3de..513bb59 100644
--- a/doc/ref/srfi-modules.texi
+++ b/doc/ref/srfi-modules.texi
@@ -3845,58 +3845,52 @@ words, no program that uses the R5RS definitions of 
delay and force will
 break if those definition are replaced by the SRFI-45 definitions of
 delay and force.
 
-Guile compatibly extends SRFI-45 to support multiple values.  It also
-adds @code{promise?} to the list of exports.
+Guile also adds @code{promise?} to the list of exports, which is not
+part of the official SRFI-45.
 
 @deffn {Scheme Procedure} promise? obj
 Return true if @var{obj} is an SRFI-45 promise, otherwise return false.
 @end deffn
 
 @deffn {Scheme Syntax} delay expression
-Takes an expression and returns a promise which at some point in the
-future may be asked (by the @code{force} procedure) to evaluate the
-expression and deliver the resulting value(s).
+Takes an expression of arbitrary type @var{a} and returns a promise of
+type @code{(Promise @var{a})} which at some point in the future may be
+asked (by the @code{force} procedure) to evaluate the expression and
+deliver the resulting value.
 @end deffn
 
 @deffn {Scheme Syntax} lazy expression
-Takes an expression (which must evaluate to a promise) and returns a
-promise which at some point in the future may be asked (by the
address@hidden procedure) to evaluate the expression and deliver the
-resulting promise.
+Takes an expression of type @code{(Promise @var{a})} and returns a
+promise of type @code{(Promise @var{a})} which at some point in the
+future may be asked (by the @code{force} procedure) to evaluate the
+expression and deliver the resulting promise.
 @end deffn
 
address@hidden {Scheme Procedure} force promise
-Takes a promise and returns the associated value(s) as follows: If
-value(s) have been computed for the promise, these value(s) are
-returned.  Otherwise, the promise is first evaluated, then overwritten
-by the obtained promise or value(s), and then force is again applied
-(iteratively) to the promise.
address@hidden {Scheme Procedure} force expression
+Takes an argument of type @code{(Promise @var{a})} and returns a value
+of type @var{a} as follows: If a value of type @var{a} has been computed
+for the promise, this value is returned.  Otherwise, the promise is
+first evaluated, then overwritten by the obtained promise or value, and
+then force is again applied (iteratively) to the promise.
 @end deffn
 
address@hidden {Scheme Procedure} eager obj ...
-Takes any number of argument(s) and returns a promise.  As opposed to
address@hidden, the argument(s) are evaluated eagerly.  Semantically,
-writing @code{(eager expression)} is equivalent to writing
address@hidden {Scheme Procedure} eager expression
+Takes an argument of type @var{a} and returns a value of type
address@hidden(Promise @var{a})}.  As opposed to @code{delay}, the argument is
+evaluated eagerly. Semantically, writing @code{(eager expression)} is
+equivalent to writing
 
 @lisp
 (let ((value expression)) (delay value)).
 @end lisp
 
 However, the former is more efficient since it does not require
-unnecessary creation and evaluation of thunks.  For expressions that
-return a single value, we also have the equivalence
+unnecessary creation and evaluation of thunks. We also have the
+equivalence
 
 @lisp
 (delay expression) = (lazy (eager expression))
 @end lisp
-
-More generally, the following equivalence holds:
-
address@hidden
-(delay expression) = (lazy (call-with-values
-                               (lambda () expression)
-                             eager))
address@hidden lisp
 @end deffn
 
 The following reduction rules may be helpful for reasoning about these
@@ -3906,7 +3900,7 @@ usage semantics specified above:
 @lisp
 (force (delay expression)) -> expression
 (force (lazy  expression)) -> (force expression)
-(force (eager obj ...))    -> (values obj ...)
+(force (eager value))      -> value
 @end lisp
 
 @subsubheading Correct usage
diff --git a/module/srfi/srfi-45.scm b/module/srfi/srfi-45.scm
index f865f91..5194770 100644
--- a/module/srfi/srfi-45.scm
+++ b/module/srfi/srfi-45.scm
@@ -25,8 +25,8 @@
 
 ;;; Commentary:
 
-;; This is the code of the reference implementation of SRFI-45,
-;; modified to use SRFI-9 and to support multiple values.
+;; This is the code of the reference implementation of SRFI-45, modified
+;; to use SRFI-9 and to add 'promise?' to the list of exports.
 
 ;; This module is documented in the Guile Reference Manual.
 
@@ -53,18 +53,16 @@
 (define-syntax-rule (lazy exp)
   (make-promise (make-value 'lazy (lambda () exp))))
 
-(define (eager . xs)
-  (make-promise (make-value 'eager xs)))
+(define (eager x)
+  (make-promise (make-value 'eager x)))
 
 (define-syntax-rule (delay exp)
-  (lazy (call-with-values
-            (lambda () exp)
-          eager)))
+  (lazy (eager exp)))
 
 (define (force promise)
   (let ((content (promise-val promise)))
     (case (value-tag content)
-      ((eager) (apply values (value-proc content)))
+      ((eager) (value-proc content))
       ((lazy)  (let* ((promise* ((value-proc content)))
                       (content  (promise-val promise)))        ; *
                  (if (not (eqv? (value-tag content) 'eager))   ; *
diff --git a/test-suite/tests/srfi-45.test b/test-suite/tests/srfi-45.test
index cb3f790..e9fd029 100644
--- a/test-suite/tests/srfi-45.test
+++ b/test-suite/tests/srfi-45.test
@@ -266,36 +266,3 @@
 
 (pass-if "promise? predicate"
   (promise? (delay 1)))
-
-;======================================================================
-; Test memoization of multiple values (non-standard Guile extension)
-
-(with-test-prefix "Multiple values (non-standard)"
-
- (let ((promise (delay (values 1 2 3))))
-   (pass-if-equal "Multiple values delay"
-       '(1 2 3)
-     (call-with-values
-         (lambda () (force promise))
-       list)))
-
- (let ((promise (eager 1 2 3)))
-   (pass-if-equal "Multiple values eager"
-       '(1 2 3)
-     (call-with-values
-         (lambda () (force promise))
-       list)))
-
- (let ((promise (delay (values))))
-   (pass-if-equal "Zero values delay"
-       '()
-     (call-with-values
-         (lambda () (force promise))
-       list)))
-
- (let ((promise (eager)))
-   (pass-if-equal "Zero values eager"
-       '()
-     (call-with-values
-         (lambda () (force promise))
-       list))))


hooks/post-receive
-- 
GNU Guile



reply via email to

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