<HTML><BODY>In Common Lisp you have to use construction like<BR><BR>(restart-case&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (/ 1 x)&nbsp;<BR>&nbsp;&nbsp;&nbsp; (use-value (value) "" value)) <BR><BR>or cerror or something like that.<BR><BR>I don't see, what prevents Racket to do the same: restart-case capture continuations and handler-case, handler-bind or debugger choose the continuation.<BR><BR>Something like:<BR><BR>(define (test l) <BR>&nbsp; (if (null? l)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (cons (let/cc k (with-handlers <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ([exn? (λ (v) (raise (cons v k)))]) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (/ 1 (car l))))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (test (cdr l)))))<BR><BR>Then&nbsp;debugger can catch the continuation and call (k new-value).<BR><BR><BR><BR><BR>Четверг, 27 июня 2013, 13:32 -06:00 от Matthew Flatt &lt;mflatt@cs.utah.edu&gt;:<BR>
<BLOCKQUOTE style="BORDER-LEFT: #0857a6 1px solid; PADDING-BOTTOM: 0px; MARGIN: 10px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; PADDING-TOP: 0px" class=mailru-blockquote>
<DIV>
<DIV class="js-helper js-readmsg-msg">
<STYLE type=text/css></STYLE>

<DIV id=style_13723616850000000757 class=mr_read__body><BASE href="https://e.mail.ru/" target=_self>
<DIV id=style_13723616850000000757_BODY>At Thu, 27 Jun 2013 12:35:10 -0400, Sean Kanaley wrote:<BR>&gt; As a more general solution to this kind of interactive debugging issue, <BR>&gt; how difficult would implementing a typical Common Lisp REPL be? I'm <BR>&gt; thinking of adding the kind of error/condition handler like:<BR>&gt; <BR>&gt; "&lt;error or condition goes here&gt;<BR>&gt; <BR>&gt; enter a number:<BR>&gt; <BR>&gt; 0 - enter new value<BR>&gt; 1 - exit to top level<BR>&gt; 2 - exit one level<BR>&gt; 3 - print stack trace<BR>&gt; 4 - etc.<BR>&gt; <BR>&gt; I'm not familiar with Racket's internals so I don't know how much this <BR>&gt; is a REPL hack vs. rewriting the whole system (the condition system <BR>&gt; isn't necessary)... If it's not too impossible I would be happy to make <BR>&gt; this contribution...<BR><BR>Racket's implementation (and maybe to some degree, I think, its design)<BR>does not support restartable exceptions, except in the case of the<BR>`exn:break' exception. So, option 0 would be difficult or impossible to<BR>implement as a hook into the run-time system.<BR><BR>A debugger could instrument programs to allow this kind of restart by<BR>wrapping every expression with a prompt, but I think that would be<BR>fairly expensive in the current implementation.<BR><BR>____________________<BR>&nbsp;&nbsp;Racket Users list:<BR>&nbsp;&nbsp;<A href="http://lists.racket-lang.org/users" target=_blank>http://lists.racket-lang.org/users</A><BR></DIV><BASE href="https://e.mail.ru/" target=_self></DIV></DIV></DIV></BLOCKQUOTE><BR><BR>-- <BR>Roman Klochkov<BR></BODY></HTML>