guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 02/04: time: Support expressions that return any number


From: Ludovic Courtès
Subject: [Guile-commits] 02/04: time: Support expressions that return any number of values.
Date: Sun, 23 Sep 2018 10:42:03 -0400 (EDT)

civodul pushed a commit to branch stable-2.2
in repository guile.

commit c3b14ff1496f3996f0bfc51e1b64eb70bd6ed0fa
Author: Ludovic Courtès <address@hidden>
Date:   Sun Sep 23 16:27:32 2018 +0200

    time: Support expressions that return any number of values.
    
    * module/ice-9/time.scm (time-proc): Call PROC with 'call-with-values';
    return all its values.
---
 module/ice-9/time.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/module/ice-9/time.scm b/module/ice-9/time.scm
index b693d61..7e3da84 100644
--- a/module/ice-9/time.scm
+++ b/module/ice-9/time.scm
@@ -35,7 +35,7 @@
 (define (time-proc proc)
   (let* ((gc-start (gc-run-time))
          (tms-start (times))
-         (result (proc))
+         (results (call-with-values proc list))
          (tms-end (times))
          (gc-end (gc-run-time)))
     ;; FIXME: We would probably like format ~f to accept rationals, but
@@ -50,7 +50,7 @@
             (get tms:cutime tms-start tms-end)
             (get tms:cstime tms-start tms-end)
             (get identity gc-start gc-end))
-    result))
+    (apply values results)))
 
 (define-syntax-rule (time exp)
   (time-proc (lambda () exp)))



reply via email to

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