GMTA I guess. That was very nice. Thank you both,<br><br>-pp<br><br><div><span class="gmail_quote"><br></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br>You can use call-with-values, values, and apply:<br><br>(define (helper thunk)<br> (setup)<br> (call-with-values thunk<br> (lambda results<br> (teardown)<br> (apply values results))))
<br><br>Ryan<br><br>> Here is my attempt:<br>><br>> (define (helper thunk)<br>> (let ((success #t))<br>> (dynamic-wind<br>> (lambda () (printf "Setup~n"))<br>> (lambda ()
<br>> (with-handlers (((lambda ex #t)<br>> (lambda (exn)<br>> (set! success #f)<br>> (raise exn))))<br>> (thunk)))
<br>> (lambda()<br>> (if success<br>> (printf "Teardown~n"))))))<br>><br>> > (helper (lambda () (values 1 2 3)))<br>> Setup<br>> Teardown<br>> 1<br>> 2
<br>> 3<br>><br>> > (helper (lambda () 1))a<br>> Setup<br>> Teardown<br>> 1<br>><br>> > (helper (lambda () (error "Abort") (values 1 2 3)))<br>> Setup<br>> > Abort<br>><br>
> This seems to work, but its ugly. Is there a nicer solution?<br>><br>> -pp<br>><br>><br>><br>><br>> -pp<br>> > _________________________________________________<br>> For list-related administrative tasks:
<br>> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>><br><br><br>__________________________________________________<br>Do You Yahoo!?<br>
Tired of spam? Yahoo! Mail has the best spam protection around<br><a href="http://mail.yahoo.com">http://mail.yahoo.com</a><br></blockquote></div><br>