From 3d170afac8f0bcbb98d3389e9939f92821e5618d Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sat, 18 Jul 2015 15:39:34 +0900 Subject: [PATCH] redefine shift and reset as syntaxes --- contrib/30.partcont/piclib/partcont.scm | 14 ++++++++++++-- contrib/50.for/piclib/for.scm | 7 +++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/contrib/30.partcont/piclib/partcont.scm b/contrib/30.partcont/piclib/partcont.scm index 4c4e3b83..3a281f28 100644 --- a/contrib/30.partcont/piclib/partcont.scm +++ b/contrib/30.partcont/piclib/partcont.scm @@ -27,6 +27,16 @@ (reset (lambda () (k v)))))))))) - (export shift - reset)) + (define-syntax reset* + (syntax-rules () + ((_ expr ...) + (reset (lambda () expr ...))))) + + (define-syntax shift* + (syntax-rules () + ((_ k expr ...) + (shift (lambda (k) expr ...))))) + + (export (rename shift* shift) + (rename reset* reset))) diff --git a/contrib/50.for/piclib/for.scm b/contrib/50.for/piclib/for.scm index 3befa0ba..5280e286 100644 --- a/contrib/50.for/piclib/for.scm +++ b/contrib/50.for/piclib/for.scm @@ -4,12 +4,11 @@ (define-syntax for (syntax-rules () - ((_ expr) - (reset (lambda () expr))))) + ((_ expr ...) + (reset expr ...)))) (define (in m) - (shift (lambda (k) - (apply append (map k m))))) + (shift k (apply append (map k m)))) (define (yield x) (list x))