guile-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Move let/ec to top-level


From: Ian Price
Subject: Re: [PATCH] Move let/ec to top-level
Date: Sat, 06 Apr 2013 03:15:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

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"

>From ffbe4cf3c151d5d5affd5baecf7b4cf65b22ce50 Mon Sep 17 00:00:00 2001
From: Ian Price <address@hidden>
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))
 
 
 ;;; 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


reply via email to

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