"Mike Gran" <spk...@yahoo.com> writes:

> Hi all,
>
> This is probably a simple question, but, I can't figure it out.
>
> I have a program with a big main loop like this
>
> (while #t
>  (let ((c (read-char port)))
>    (cond
>     ... many different possible operations, depending on c
>     )))
>
> I want to make it so, when the program receives a SIGINT, it aborts
> the operation in progress and restarts this big main loop.
>
> Any hints?
>
> Thanks,
> Mike Gran

This is an interesting question. I come up with a solution using the
reset/shift operators. This is the first time I use delimited
continuation. The script is in the attachment. You can run
'chmod +x main-loop.scm' to make the script executable.

Attachment: main-loop.scm
Description: Binary data

Cheers,
Alex

Attachment: signature.asc
Description: PGP signature

Reply via email to