This is a goofy and or fun beginner exercise to see how call-with-current-continuation and dynamic-wind? can interact in a rather displeasing manner. What happens when you run this in the REPL? What happens when you try and break?
(let loop ()
(call-with-current-continuation
(lambda (k)
(dynamic-wind
(lambda () #t)
(lambda () (let loop () (loop)))
k)))
(loop))
Note: According to R5RS,
The effect of using a captured continuation to enter or exit the dynamic extent of a call to before or after is undefined. (Those procedures are the first & third arguments, respectively.)
category-code category-learning-scheme
I've been told that it's generally a bad idea to call a continuation from the before or after thunks of dynamic-wind...