* [PATCH] Move let/ec to top-level @ 2013-01-14 15:20 Nala Ginrut 2013-01-22 11:43 ` Andy Wingo 2013-03-27 21:14 ` Ludovic Courtès 0 siblings, 2 replies; 11+ messages in thread From: Nala Ginrut @ 2013-01-14 15:20 UTC (permalink / raw) To: guile-devel [-- Attachment #1.1: Type: text/plain, Size: 106 bytes --] I believe this delayed for a 6+ months. And I'm glad to see it's implemented with delimited-continuation. [-- Attachment #1.2: Type: text/html, Size: 135 bytes --] [-- Attachment #2: 0001-Move-let-ec-to-top-level.patch --] [-- Type: application/octet-stream, Size: 1656 bytes --] From 67ae47bc511f36a3cec362dd9ad499a32d2b9c69 Mon Sep 17 00:00:00 2001 From: Nala Ginrut <NalaGinrut@gmail.com> Date: Mon, 14 Jan 2013 22:38:01 +0800 Subject: [PATCH] Move let/ec to top-level. --- module/ice-9/boot-9.scm | 9 +++++++++ module/ice-9/futures.scm | 10 ---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index e426374..85b380d 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -419,6 +419,15 @@ If there is no handler at all, Guile prints an error and then exits." (define-syntax-rule (unless test stmt stmt* ...) (if (not test) (begin stmt stmt* ...))) +(define-syntax-rule (let/ec k e e* ...) + (let ((tag (make-prompt-tag))) + (call-with-prompt + tag + (lambda () + (let ((k (lambda args (apply abort-to-prompt tag args)))) + e e* ...)) + (lambda (_ res) res)))) + (define-syntax cond (lambda (whole-expr) (define (fold f seed xs) diff --git a/module/ice-9/futures.scm b/module/ice-9/futures.scm index 6ff104d..069a4f5 100644 --- a/module/ice-9/futures.scm +++ b/module/ice-9/futures.scm @@ -99,16 +99,6 @@ touched." (lambda () (begin e0 e1 ...)) (lambda () (unlock-mutex x))))) -(define-syntax-rule (let/ec k e e* ...) ; TODO: move to core - (let ((tag (make-prompt-tag))) - (call-with-prompt - tag - (lambda () - (let ((k (lambda args (apply abort-to-prompt tag args)))) - e e* ...)) - (lambda (_ res) res)))) - - (define %future-prompt ;; The prompt futures abort to when they want to wait for another ;; future. -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] Move let/ec to top-level 2013-01-14 15:20 [PATCH] Move let/ec to top-level Nala Ginrut @ 2013-01-22 11:43 ` Andy Wingo 2013-03-27 21:14 ` Ludovic Courtès 1 sibling, 0 replies; 11+ messages in thread From: Andy Wingo @ 2013-01-22 11:43 UTC (permalink / raw) To: Nala Ginrut; +Cc: guile-devel Hi Nala, This form is missing documentation and a test case. I would also add it to (ice-9 control) instead of to the core, along with the corresponding call/ec and perhaps the longer names as well. On Mon 14 Jan 2013 16:20, Nala Ginrut <nalaginrut@gmail.com> writes: > +(define-syntax-rule (let/ec k e e* ...) > + (let ((tag (make-prompt-tag))) > + (call-with-prompt > + tag > + (lambda () > + (let ((k (lambda args (apply abort-to-prompt tag args)))) > + e e* ...)) > + (lambda (_ res) res)))) > + Here the handler should be: (lambda (_ . results) (apply values results)) I would also look for let/ec in the rest of Guile and change them to use the core definition (in peval for example I know there is one). Andy -- http://wingolog.org/ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Move let/ec to top-level 2013-01-14 15:20 [PATCH] Move let/ec to top-level Nala Ginrut 2013-01-22 11:43 ` Andy Wingo @ 2013-03-27 21:14 ` Ludovic Courtès 2013-04-04 6:19 ` Nala Ginrut 1 sibling, 1 reply; 11+ messages in thread From: Ludovic Courtès @ 2013-03-27 21:14 UTC (permalink / raw) To: guile-devel Sounds good to me, but can you also (1) add doc, probably under “Prompt Primitives”, with cross-refs from the “Exceptions” section, and (2) write a ChangeLog-style commit log? Thanks, Ludo’. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Move let/ec to top-level 2013-03-27 21:14 ` Ludovic Courtès @ 2013-04-04 6:19 ` Nala Ginrut 2013-04-05 20:59 ` Ludovic Courtès ` (3 more replies) 0 siblings, 4 replies; 11+ messages in thread From: Nala Ginrut @ 2013-04-04 6:19 UTC (permalink / raw) To: Ludovic Courtès; +Cc: guile-devel [-- Attachment #1: Type: text/plain, Size: 357 bytes --] On Wed, 2013-03-27 at 22:14 +0100, Ludovic Courtès wrote: > Sounds good to me, but can you also (1) add doc, probably under “Prompt > Primitives”, with cross-refs from the “Exceptions” section, and (2) > write a ChangeLog-style commit log? > > Thanks, > Ludo’. > > Add call/ec and let/ec to (ice-9 control) with docs in the manual. Thanks! [-- Attachment #2: 0001-Add-escape-continuation-with-docs.patch --] [-- Type: text/x-patch, Size: 4147 bytes --] From 0c899e96d9667a88ceb17cfbcdedf3e18aeef21c Mon Sep 17 00:00:00 2001 From: Nala Ginrut <nalaginrut@gmail.com> Date: Thu, 4 Apr 2013 14:14:25 +0800 Subject: [PATCH] Add escape continuation with docs * ref/api-control.texi: Add docs * ice-9/control.scm: Add let/ec and call/ec * ice-9/futures.scm: Remove the old let/ec implementation. --- doc/ref/api-control.texi | 23 +++++++++++++++++++++++ module/ice-9/control.scm | 27 +++++++++++++++++++++++++-- module/ice-9/futures.scm | 11 +---------- 3 files changed, 49 insertions(+), 12 deletions(-) diff --git a/doc/ref/api-control.texi b/doc/ref/api-control.texi index 320812d..9ddeeb0 100644 --- a/doc/ref/api-control.texi +++ b/doc/ref/api-control.texi @@ -577,6 +577,29 @@ Before moving on, we should mention that if the handler of a prompt is a that prompt will not cause a continuation to be reified. This can be an important efficiency consideration to keep in mind. +@deffn {Scheme Procedure} call/ec proc +'ec' stands for escape-continuation, or so-called 'one-shot' continuation. +@var{call/ec} is equivalent to call-with-escape-continuation. +A continuation obtained from call/ec is actually a kind of prompt. @var{call/ec} +is often an easy replacement for @var{call/cc} to improve performance. +More details read @uref{http://www.cs.indiana.edu/~bruggema/one-shots-abstract.html, +Representing control in the presence of one-shot continuations}. +@end deffn + +@deffn {Scheme Syntax} let/ec k body +Equivalent to (call/ec (lambda (k) body ...)). +@end deffn + +@example +(use-module (ice-9 control)) + +(call/ec (lambda (return) + (return 123))) + +(let/ec return (return 123)) +@end example + + @node Shift and Reset @subsubsection Shift, Reset, and All That diff --git a/module/ice-9/control.scm b/module/ice-9/control.scm index 5f25738..4a114fd 100644 --- a/module/ice-9/control.scm +++ b/module/ice-9/control.scm @@ -1,6 +1,6 @@ ;;; Beyond call/cc -;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. +;; Copyright (C) 2010, 2011, 2013 Free Software Foundation, Inc. ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -21,7 +21,7 @@ (define-module (ice-9 control) #:re-export (call-with-prompt abort-to-prompt default-prompt-tag make-prompt-tag) - #:export (% abort shift reset shift* reset*)) + #:export (% abort shift reset shift* reset* call/ec let/ec)) (define (abort . args) (apply abort-to-prompt (default-prompt-tag) args)) @@ -76,3 +76,26 @@ (define (shift* fc) (shift c (fc c))) + +(define %call/ec-prompt + (make-prompt-tag)) + +(define-syntax-rule (call/ec proc) + ;; aka. `call-with-escape-continuation' + (let ((tag (make-prompt-tag))) + (call-with-prompt + tag + (lambda () + (proc (lambda args (apply abort-to-prompt args)))) + (lambda (_ . args) + (apply values args))))) + +(define-syntax-rule (let/ec k e e* ...) + ;; aka. `let-escape-continuation' + (let ((tag (make-prompt-tag))) + (call-with-prompt + tag + (lambda () + (let ((k (lambda args (apply abort-to-prompt tag args)))) + e e* ...)) + (lambda (_ . results) (apply values results))))) diff --git a/module/ice-9/futures.scm b/module/ice-9/futures.scm index 35a36ca..90bbe53 100644 --- a/module/ice-9/futures.scm +++ b/module/ice-9/futures.scm @@ -23,6 +23,7 @@ #:use-module (srfi srfi-11) #:use-module (ice-9 q) #:use-module (ice-9 match) + #:use-module (ice-9 control) #:export (future make-future future? touch)) ;;; Author: Ludovic Courtès <ludo@gnu.org> @@ -105,16 +106,6 @@ touched." (lambda () (begin e0 e1 ...)) (lambda () (unlock-mutex x))))) -(define-syntax-rule (let/ec k e e* ...) ; TODO: move to core - (let ((tag (make-prompt-tag))) - (call-with-prompt - tag - (lambda () - (let ((k (lambda args (apply abort-to-prompt tag args)))) - e e* ...)) - (lambda (_ res) res)))) - - (define %future-prompt ;; The prompt futures abort to when they want to wait for another ;; future. -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] Move let/ec to top-level 2013-04-04 6:19 ` Nala Ginrut @ 2013-04-05 20:59 ` Ludovic Courtès 2013-04-06 0:52 ` Ian Price ` (2 subsequent siblings) 3 siblings, 0 replies; 11+ messages in thread From: Ludovic Courtès @ 2013-04-05 20:59 UTC (permalink / raw) To: Nala Ginrut; +Cc: guile-devel Nala Ginrut <nalaginrut@gmail.com> skribis: > Add call/ec and let/ec to (ice-9 control) with docs in the manual. I ended up making many changes (some suggested by Mark on IRC), and the result is commit 55e26a4. Please note the differences. It would be beneficial if your future submissions could be closer to our expectations. Thanks, Ludo’. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Move let/ec to top-level 2013-04-04 6:19 ` Nala Ginrut 2013-04-05 20:59 ` Ludovic Courtès @ 2013-04-06 0:52 ` Ian Price 2013-04-06 2:53 ` Nala Ginrut 2013-04-06 1:04 ` Ian Price 2013-04-06 2:15 ` Ian Price 3 siblings, 1 reply; 11+ messages in thread From: Ian Price @ 2013-04-06 0:52 UTC (permalink / raw) To: Nala Ginrut; +Cc: Ludovic Courtès, guile-devel Nala Ginrut <nalaginrut@gmail.com> writes: > +@deffn {Scheme Procedure} call/ec proc > +'ec' stands for escape-continuation, or so-called 'one-shot' continuation. > +@var{call/ec} is equivalent to call-with-escape-continuation. > +A continuation obtained from call/ec is actually a kind of prompt. @var{call/ec} > +is often an easy replacement for @var{call/cc} to improve performance. > +More details read @uref{http://www.cs.indiana.edu/~bruggema/one-shots-abstract.html, > +Representing control in the presence of one-shot continuations}. > +@end deffn This isn't any good. It doesn't tell us what an escape continuation is, it doesn't tell us how to use it, and it only hints at why you should use them. Yeah, if you know what a continuation is "one-shot continuation" isn't going to be a surprising definition, but we can do better than that in Guile's manual. Here is something closer to how I envision this section should be written. I have not taken the liberty of texinfoifying it. ---- Often in Guile, you do not need the full unrestricted power of first class continuations, you just want an escape. For example, to break out of multiplying a list of numbers, you might write (define (product list) (call-with-current-continuation (lambda (break) (let loop ((list list) (product 1)) (cond ((null? list) product) ((zero? (car list)) (break 0)) (else (loop (cdr list) (* (car list) product)))))))) In this case, it can be more transparent, and more efficient, to use a restricted form of continuation, which we refer to as an escape (or one-shot) continuation, that only permits you to call it once from to escape from inside the body of the function. Scheme Procedure call-with-escape-continuation proc Scheme Procedure call/ec proc Capture the current escape-only continuation, and call proc with this continuation as its argument. The return value(s) of this expression are the value(s) returned by proc, or, the arguments passed to the escape continuation if it is invoked. If the escape continuation is invoked more than once, or it is invoked after proc has returned, it is an $error. call/ec is an alias for call-with-escape-continuation ---- I didn't check what error actually gets returned, so that bit needs filled in. In various parts of the manual, we mention that prompts should be used for the situation of escapes. We should probably hunt those down and replace those with recommendations to use call/ec or let/ec. > +@deffn {Scheme Syntax} let/ec k body > +Equivalent to (call/ec (lambda (k) body ...)). > +@end deffn Missing ellipses in the function prototype. In Texinfo, you should be using @dots{} rather than three periods for ellipses. > +@example > +(use-module (ice-9 control)) > + > +(call/ec (lambda (return) > + (return 123))) > + > +(let/ec return (return 123)) > +@end example Not a particularly convincing example, maybe drop it? > + > +(define %call/ec-prompt > + (make-prompt-tag)) You don't use this, so you can remove it. If your intent was to reuse the prompt so that you didn't have to do a gensym each time, beware, this won't give the correct semantics for call/ec. e.g. (call/ec (lambda (outer) (call/ec (lambda (inner) (outer #f))) #t)) will return #t rather than #f > +(define-syntax-rule (call/ec proc) define rather than define-syntax-rule > + ;; aka. `call-with-escape-continuation' Rather than an aka in a comment, maybe we should export this. In the example documentation given above, I've assumed this. > + (let ((tag (make-prompt-tag))) > + (call-with-prompt > + tag > + (lambda () > + (proc (lambda args (apply abort-to-prompt args)))) you are not aborting to the tag, but to the first of the args (the dangers of copy-paste) > + (lambda (_ . args) > + (apply values args))))) > + > +(define-syntax-rule (let/ec k e e* ...) > + ;; aka. `let-escape-continuation' Rather let-with-escape-continuation than let-escape-continuation, since it's the same convention as with call/ec and call/cc (not that it matters if we don't export it) As an aside, we don't have a corresponding let/cc, but I suspect most uses of it in practice would be replaced by let/ec. > -(define-syntax-rule (let/ec k e e* ...) ; TODO: move to core > - (let ((tag (make-prompt-tag))) > - (call-with-prompt > - tag > - (lambda () > - (let ((k (lambda args (apply abort-to-prompt tag args)))) > - e e* ...)) > - (lambda (_ res) res)))) > - > - > (define %future-prompt > ;; The prompt futures abort to when they want to wait for another > ;; future. This isn't the only definition of let/ec in the Guile source code. I see definitions in module/language/tree-il/peval.scm and module/sxml/match.scm (as an aside, I notice match.scm makes the prompt reuse mistake you almost did) -- Ian Price -- shift-reset.com "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled" ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Move let/ec to top-level 2013-04-06 0:52 ` Ian Price @ 2013-04-06 2:53 ` Nala Ginrut 0 siblings, 0 replies; 11+ messages in thread From: Nala Ginrut @ 2013-04-06 2:53 UTC (permalink / raw) To: Ian Price; +Cc: Ludovic Courtès, guile-devel [-- Attachment #1: Type: text/plain, Size: 5654 bytes --] 在 2013-4-6 AM8:53,"Ian Price" <ianprice90@googlemail.com>写道: > > Nala Ginrut <nalaginrut@gmail.com> writes: > > > +@deffn {Scheme Procedure} call/ec proc > > +'ec' stands for escape-continuation, or so-called 'one-shot' continuation. > > +@var{call/ec} is equivalent to call-with-escape-continuation. > > +A continuation obtained from call/ec is actually a kind of prompt. @var{call/ec} > > +is often an easy replacement for @var{call/cc} to improve performance. > > +More details read @uref{ http://www.cs.indiana.edu/~bruggema/one-shots-abstract.html, > > +Representing control in the presence of one-shot continuations}. > > +@end deffn > This isn't any good. It doesn't tell us what an escape continuation is, > it doesn't tell us how to use it, and it only hints at why you should > use them. Yeah, if you know what a continuation is "one-shot > continuation" isn't going to be a surprising definition, but we can do > better than that in Guile's manual. > > Here is something closer to how I envision this section should be > written. I have not taken the liberty of texinfoifying it. > > ---- > Often in Guile, you do not need the full unrestricted power of first > class continuations, you just want an escape. For example, to break > out of multiplying a list of numbers, you might write > > (define (product list) > (call-with-current-continuation > (lambda (break) > (let loop ((list list) (product 1)) > (cond ((null? list) product) > ((zero? (car list)) (break 0)) > (else (loop (cdr list) (* (car list) product)))))))) > > In this case, it can be more transparent, and more efficient, to use a > restricted form of continuation, which we refer to as an escape (or > one-shot) continuation, that only permits you to call it once from to > escape from inside the body of the function. > > > Scheme Procedure call-with-escape-continuation proc > Scheme Procedure call/ec proc > > Capture the current escape-only continuation, and call proc with this > continuation as its argument. The return value(s) of this expression > are the value(s) returned by proc, or, the arguments passed to the > escape continuation if it is invoked. > > If the escape continuation is invoked more than once, or it is invoked > after proc has returned, it is an $error. > > call/ec is an alias for call-with-escape-continuation > ---- > > I didn't check what error actually gets returned, so that bit needs > filled in. > > In various parts of the manual, we mention that prompts should be used > for the situation of escapes. We should probably hunt those down and > replace those with recommendations to use call/ec or let/ec. > > > +@deffn {Scheme Syntax} let/ec k body > > +Equivalent to (call/ec (lambda (k) body ...)). > > +@end deffn > Missing ellipses in the function prototype. In Texinfo, you should be > using @dots{} rather than three periods for ellipses. > > > +@example > > +(use-module (ice-9 control)) > > + > > +(call/ec (lambda (return) > > + (return 123))) > > + > > +(let/ec return (return 123)) > > +@end example > Not a particularly convincing example, maybe drop it? > > > + > > +(define %call/ec-prompt > > + (make-prompt-tag)) > You don't use this, so you can remove it. If your intent was to reuse > the prompt so that you didn't have to do a gensym each time, beware, > this won't give the correct semantics for call/ec. > > e.g. > (call/ec > (lambda (outer) > (call/ec > (lambda (inner) > (outer #f))) > #t)) > > will return #t rather than #f > > > +(define-syntax-rule (call/ec proc) > define rather than define-syntax-rule > > > + ;; aka. `call-with-escape-continuation' > Rather than an aka in a comment, maybe we should export this. In the > example documentation given above, I've assumed this. > > > + (let ((tag (make-prompt-tag))) > > + (call-with-prompt > > + tag > > + (lambda () > > + (proc (lambda args (apply abort-to-prompt args)))) > you are not aborting to the tag, but to the first of the args > (the dangers of copy-paste) > > > + (lambda (_ . args) > > + (apply values args))))) > > + > > +(define-syntax-rule (let/ec k e e* ...) > > + ;; aka. `let-escape-continuation' > Rather let-with-escape-continuation than let-escape-continuation, since > it's the same convention as with call/ec and call/cc (not that it > matters if we don't export it) > > As an aside, we don't have a corresponding let/cc, but I suspect most > uses of it in practice would be replaced by let/ec. > > > -(define-syntax-rule (let/ec k e e* ...) ; TODO: move to core > > - (let ((tag (make-prompt-tag))) > > - (call-with-prompt > > - tag > > - (lambda () > > - (let ((k (lambda args (apply abort-to-prompt tag args)))) > > - e e* ...)) > > - (lambda (_ res) res)))) > > - > > - > > (define %future-prompt > > ;; The prompt futures abort to when they want to wait for another > > ;; future. > This isn't the only definition of let/ec in the Guile source code. I see > definitions in module/language/tree-il/peval.scm and > module/sxml/match.scm (as an aside, I notice match.scm makes the prompt > reuse mistake you almost did) > Yes, but the original purpose is to move the "futures" one. And I apologize for the redundant things. :-( > -- > Ian Price -- shift-reset.com > > "Programming is like pinball. The reward for doing it well is > the opportunity to do it again" - from "The Wizardy Compiled" [-- Attachment #2: Type: text/html, Size: 7290 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Move let/ec to top-level 2013-04-04 6:19 ` Nala Ginrut 2013-04-05 20:59 ` Ludovic Courtès 2013-04-06 0:52 ` Ian Price @ 2013-04-06 1:04 ` Ian Price 2013-04-06 13:38 ` Ludovic Courtès 2013-04-06 2:15 ` Ian Price 3 siblings, 1 reply; 11+ messages in thread From: Ian Price @ 2013-04-06 1:04 UTC (permalink / raw) To: Nala Ginrut; +Cc: Ludovic Courtès, guile-devel Okay, apparently Ludovic already mailed the list about this, but I didn't see it due to a stale gnus. Ah well. Such is life. -- Ian Price -- shift-reset.com "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled" ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Move let/ec to top-level 2013-04-06 1:04 ` Ian Price @ 2013-04-06 13:38 ` Ludovic Courtès 0 siblings, 0 replies; 11+ messages in thread From: Ludovic Courtès @ 2013-04-06 13:38 UTC (permalink / raw) To: Ian Price; +Cc: guile-devel Ian Price <ianprice90@googlemail.com> skribis: > Okay, apparently Ludovic already mailed the list about this, but I > didn't see it due to a stale gnus. Yes. :-/ I think all your suggestions are incorporated in 55e26a4, but let me know if something’s missing. Ludo’. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Move let/ec to top-level 2013-04-04 6:19 ` Nala Ginrut ` (2 preceding siblings ...) 2013-04-06 1:04 ` Ian Price @ 2013-04-06 2:15 ` Ian Price 2013-04-06 13:41 ` Ludovic Courtès 3 siblings, 1 reply; 11+ messages in thread From: Ian Price @ 2013-04-06 2:15 UTC (permalink / raw) To: Ludovic Courtès; +Cc: guile-devel [-- Attachment #1: Type: text/plain, Size: 219 bytes --] Attached is a patch to remove the duplicated definitions. -- Ian Price -- shift-reset.com "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled" [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: remove duplicates --] [-- Type: text/x-patch, Size: 2380 bytes --] From ffbe4cf3c151d5d5affd5baecf7b4cf65b22ce50 Mon Sep 17 00:00:00 2001 From: Ian Price <ianprice90@googlemail.com> Date: Sat, 6 Apr 2013 03:06:25 +0100 Subject: [PATCH] Remove duplicate definitions of `call/ec' and `let/ec'. * module/language/tree-il/peval.scm (let/ec): Remove. Import (ice-9 control). * module/sxml/match.scm (%call/ec-prompt, call/ec, let/ec): Remove. Import (ice-9 control). --- module/language/tree-il/peval.scm | 10 +--------- module/sxml/match.scm | 19 ++----------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/module/language/tree-il/peval.scm b/module/language/tree-il/peval.scm index bf96179..a6e4076 100644 --- a/module/language/tree-il/peval.scm +++ b/module/language/tree-il/peval.scm @@ -26,6 +26,7 @@ #:use-module (srfi srfi-9) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) + #:use-module (ice-9 control) #:export (peval)) ;;; @@ -73,15 +74,6 @@ (newline) (values))) -(define-syntax-rule (let/ec k e e* ...) - (let ((tag (make-prompt-tag))) - (call-with-prompt - tag - (lambda () - (let ((k (lambda args (apply abort-to-prompt tag args)))) - e e* ...)) - (lambda (_ res) res)))) - (define (tree-il-any proc exp) (let/ec k (tree-il-fold (lambda (exp res) diff --git a/module/sxml/match.scm b/module/sxml/match.scm index 84cbce3..2cfe643 100644 --- a/module/sxml/match.scm +++ b/module/sxml/match.scm @@ -20,7 +20,8 @@ sxml-match-let sxml-match-let*) #:use-module (srfi srfi-1) - #:use-module (srfi srfi-11)) + #:use-module (srfi srfi-11) + #:use-module (ice-9 control)) \f ;;; Commentary: @@ -46,22 +47,6 @@ (define-syntax-rule (void) *unspecified*) -(define %call/ec-prompt - (make-prompt-tag)) - -(define-syntax-rule (call/ec proc) - ;; aka. `call-with-escape-continuation' - (call-with-prompt %call/ec-prompt - (lambda () - (proc (lambda args - (apply abort-to-prompt - %call/ec-prompt args)))) - (lambda (_ . args) - (apply values args)))) - -(define-syntax-rule (let/ec cont body ...) - (call/ec (lambda (cont) body ...))) - (define (raise-syntax-error x msg obj sub) (throw 'sxml-match-error x msg obj sub)) -- 1.7.7.6 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] Move let/ec to top-level 2013-04-06 2:15 ` Ian Price @ 2013-04-06 13:41 ` Ludovic Courtès 0 siblings, 0 replies; 11+ messages in thread From: Ludovic Courtès @ 2013-04-06 13:41 UTC (permalink / raw) To: Ian Price; +Cc: guile-devel Ian Price <ianprice90@googlemail.com> skribis: > From ffbe4cf3c151d5d5affd5baecf7b4cf65b22ce50 Mon Sep 17 00:00:00 2001 > From: Ian Price <ianprice90@googlemail.com> > Date: Sat, 6 Apr 2013 03:06:25 +0100 > Subject: [PATCH] Remove duplicate definitions of `call/ec' and `let/ec'. > > * module/language/tree-il/peval.scm (let/ec): Remove. Import > (ice-9 control). > * module/sxml/match.scm (%call/ec-prompt, call/ec, let/ec): > Remove. Import (ice-9 control). Applied, thanks! Ludo’. ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-04-06 13:41 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-01-14 15:20 [PATCH] Move let/ec to top-level Nala Ginrut 2013-01-22 11:43 ` Andy Wingo 2013-03-27 21:14 ` Ludovic Courtès 2013-04-04 6:19 ` Nala Ginrut 2013-04-05 20:59 ` Ludovic Courtès 2013-04-06 0:52 ` Ian Price 2013-04-06 2:53 ` Nala Ginrut 2013-04-06 1:04 ` Ian Price 2013-04-06 13:38 ` Ludovic Courtès 2013-04-06 2:15 ` Ian Price 2013-04-06 13:41 ` Ludovic Courtès
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).