From 8388e8ed3319a5f39fc17df0b2d20c59e753f9dc Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Mon, 19 May 2014 20:35:31 +0900 Subject: [PATCH] shift/control broken --- README.md | 2 -- contrib/partcont/piclib/partcont.scm | 28 +++++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index b9cc8cd3..301423ba 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,6 @@ Picrin is a lightweight scheme implementation intended to comply with full R7RS - `(reset h)` - `(shift k)` - - `(prompt h)` - - `(control k)` delimited control operators diff --git a/contrib/partcont/piclib/partcont.scm b/contrib/partcont/piclib/partcont.scm index 0ced262d..4c4e3b83 100644 --- a/contrib/partcont/piclib/partcont.scm +++ b/contrib/partcont/piclib/partcont.scm @@ -5,26 +5,28 @@ (define m #f) + (define (abort t) + (let ((v (t))) ; (t) may update m. do not place me like (m (t)) + (m v))) + (define (reset t) - (call/cc - (lambda (k) - (let ((n m)) + (let ((n m)) + (call/cc + (lambda (k) (set! m (lambda (r) (set! m n) (k r))) - (t))))) + (abort t))))) (define (shift h) (call/cc (lambda (k) - (h (lambda (v) - (reset (lambda () - (k v)))))))) - - (define prompt reset) - (define control shift) + (abort + (lambda () + (h (lambda (v) + (reset (lambda () + (k v)))))))))) (export shift - reset - control - prompt)) + reset)) +