mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-28 07:50:20 +02:00
(Dynamic Wind): Reformat example a bit to avoid
going off the right edge of the paper. Reported by Percy Tiglao.
This commit is contained in:
parent
bcbecaf7fd
commit
4d84f173ef
1 changed files with 18 additions and 17 deletions
|
@ -1234,28 +1234,29 @@ non-locally, @var{out_guard} is called. If the dynamic extent of
|
|||
the dynamic-wind is re-entered, @var{in_guard} is called. Thus
|
||||
@var{in_guard} and @var{out_guard} may be called any number of
|
||||
times.
|
||||
|
||||
@lisp
|
||||
(define x 'normal-binding)
|
||||
@result{} x
|
||||
(define a-cont (call-with-current-continuation
|
||||
(lambda (escape)
|
||||
(let ((old-x x))
|
||||
(dynamic-wind
|
||||
;; in-guard:
|
||||
;;
|
||||
(lambda () (set! x 'special-binding))
|
||||
(define a-cont
|
||||
(call-with-current-continuation
|
||||
(lambda (escape)
|
||||
(let ((old-x x))
|
||||
(dynamic-wind
|
||||
;; in-guard:
|
||||
;;
|
||||
(lambda () (set! x 'special-binding))
|
||||
|
||||
;; thunk
|
||||
;;
|
||||
(lambda () (display x) (newline)
|
||||
(call-with-current-continuation escape)
|
||||
(display x) (newline)
|
||||
x)
|
||||
|
||||
;; out-guard:
|
||||
;;
|
||||
(lambda () (set! x old-x)))))))
|
||||
;; thunk
|
||||
;;
|
||||
(lambda () (display x) (newline)
|
||||
(call-with-current-continuation escape)
|
||||
(display x) (newline)
|
||||
x)
|
||||
|
||||
;; out-guard:
|
||||
;;
|
||||
(lambda () (set! x old-x)))))))
|
||||
;; Prints:
|
||||
special-binding
|
||||
;; Evaluates to:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue