redefine shift and reset as syntaxes

This commit is contained in:
Yuichi Nishiwaki 2015-07-18 15:39:34 +09:00
parent b7bb3fa1cf
commit 3d170afac8
2 changed files with 15 additions and 6 deletions

View File

@ -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)))

View File

@ -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))