home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
s
/
s48.zip
/
MISC
/
WIND-TES.SCM
< prev
next >
Wrap
Text File
|
1992-06-17
|
1KB
|
52 lines
; Copyright (c) 1992 by Richard Kelsey and Jonathan Rees. See file COPYING.
; The correct output is something like this:
; wind-1 f: 1
; wind-2 f: 2
; before-throw-out f: 3
; unwind-2 f: 2
; unwind-1 f: 1
; after-throw-out f: top
; wind-1 f: 1
; wind-2 f: 2
; after-throw-in f: 3
; unwind-2 f: 2
; unwind-1 f: 1
; done f: top
(define (wind-test)
(let* ((f (make-fluid 'top))
(report (lambda (foo)
(write foo)
(display " f: ")
(write (fluid f))
(newline))))
((cwcc
(lambda (k1)
(let-fluid f 1
(lambda ()
(dynamic-wind
(lambda () (report 'wind-1))
(lambda ()
(let-fluid f 2
(lambda ()
(dynamic-wind
(lambda () (report 'wind-2))
(lambda ()
(let-fluid f 3
(lambda ()
(report 'before-throw-out)
(cwcc
(lambda (k2)
(k1 (lambda ()
(report 'after-throw-out)
(k2 #f)))))
(report 'after-throw-in)
(lambda () (report 'done)))))
(lambda () (report 'unwind-2))))))
(lambda () (report 'unwind-1))))))))))
(define cwcc call-with-current-continuation)