shift/control broken
This commit is contained in:
parent
5c59dcd564
commit
8388e8ed33
|
@ -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
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
Loading…
Reference in New Issue