I've started trying to write code that would allow me to take an existing while-loop or for-loop and augment it with the ability for a user to pause the computation and terminate it early. This is really useful in Optim, where you might want to stop optimizing as soon as the solution hits a point you consider acceptable.
After a bunch of hacking based on suggestions that Jameson gave me a long time ago, I've gotten something that works when run outside of a REPL: https://gist.github.com/johnmyleswhite/bb184e2fb202b262ef35 But I'm a little lost when thinking about the modifications I need to get this working in a REPL, where I seem to be fighting with the REPL for access to raw unbuffer input from STDIN. I'd also love to know if the solution I've hit upon is something that's reasonable to hope will work in the future. The whole thing is clearly a hack, but I can't tell if the principle is sound or not. -- John
