Is it possible to define a procedure f
such that it prints Exiting...
if it is the last thing to do before exiting, and prints Not done yet...
otherwise?
For examples,
(display "hello, world\n")
(f)
should give
hello, world
Exiting...
While
(f)
(display "bye, world\n")
should give
Not done yet...
bye, world
I have thought about using control operators such as shift
/ reset
, but with no success. The key difficulty seems to be that there is no way to tell if the current continuation is terminating. Any idea?