chicken-hackers
[Top][All Lists]
Advanced

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

[Chicken-hackers] [PATCH] make printed representation of continuation wr


From: Felix
Subject: [Chicken-hackers] [PATCH] make printed representation of continuation wrapper procedure a bit more useful
Date: Wed, 01 Aug 2012 13:50:12 +0200 (CEST)

The attached patch uses a local named procedure for continuation-wrapper
closures returned by "call/cc", as suggested by Jeronimo Pellegrini.


cheers,
felix
>From 5cc82c762e01a062827e4140fc35478490a0fdf1 Mon Sep 17 00:00:00 2001
From: felix <address@hidden>
Date: Wed, 1 Aug 2012 13:48:27 +0200
Subject: [PATCH] use named procedure for continuation wrapper for a slightly 
more useful printed representation

---
 library.scm |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/library.scm b/library.scm
index 67f859f..ebf7ff4 100644
--- a/library.scm
+++ b/library.scm
@@ -1641,11 +1641,11 @@ EOF
   (let ((winds ##sys#dynamic-winds))
     (##sys#call-with-current-continuation
      (lambda (cont)
-       (proc
-       (lambda results
-         (unless (eq? ##sys#dynamic-winds winds)
-           (##sys#dynamic-unwind winds (fx- (length ##sys#dynamic-winds) 
(length winds))) )
-         (apply cont results) ) ) ) ) ) )
+       (define (continuation . results)
+        (unless (eq? ##sys#dynamic-winds winds)
+          (##sys#dynamic-unwind winds (fx- (length ##sys#dynamic-winds) 
(length winds))) )
+        (apply cont results) )
+       (proc continuation)))))
 
 (define call/cc call-with-current-continuation)
 
-- 
1.7.0.4


reply via email to

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