<div><div><span id="_user_matthias@ccs.neu.edu" style="color: rgb(121, 6, 25);">Matthias thanks</span> a lot<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
1. How can I use control.ss so that I don't need two call/cc's to<br>implement a switch of control?</blockquote><div><br>something like this?<br>---------------<br>(require (lib "control.ss"))<br><br>(define-syntax make-gen
<br> (syntax-rules ()<br> [(_ yield-name (name arg ...) body ...)<br> (define (name arg ...)<br> (define (control-state) body ...)<br> (define (yield-name value) <br> (control resume-here (set! control-state resume-here) value))
<br> (lambda () (prompt (control-state))))<br> ]))<br> <br>(make-gen yield (make-step)<br> (yield 1)<br> (yield 2)<br> (yield 3)<br> 'finished)<br><br>(define step (make-step))<br><br>(step) (step) (step) (step) (step)
<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">2. How can I use the macro system to eliminate the 'yield-name' part<br>of the macro?
</blockquote><div><br>That's the bit I need to work on, I suppose :) I'll play with that later today.<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You may also realize that step is a non-re-entrant function. Argh.<br>But I didn't choose that part :-)</blockquote><div><br>Yes, it is not. But then again the python/lua equivalents are not really reentrant either, and I just try to mimic those. At least for now. Turning this into a 'factory' I think improves somewhat the practicality of the code.
<br></div><br>Vlado<br></div><br>