[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shift and reset, plus] "while"
From: |
Andy Wingo |
Subject: |
Re: [shift and reset, plus] "while" |
Date: |
Thu, 28 Apr 2011 14:15:20 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
On Wed 13 Apr 2011 19:31, Wolfgang J Moeller <address@hidden> writes:
> Last resort: Once we do allow for argument(s) to (break),
>
> (while #t ... (break x) ... (break y) ...)
If I understand you right, this is more like a coroutine, which could
use an orthogonal form:
(define-syntax with-yield
(lambda (x)
(syntax-case x ()
((_ yield exp exp* ...) (identifier? #'yield)
#'(let ((tag (make-prompt-tag)))
(define (handler k . args)
(define (resume . args)
(call-with-prompt tag
(lambda () (apply k args))
handler))
(apply values resume args))
(call-with-prompt
tag
(lambda ()
(let-syntax ((yield (syntax-rules ()
((_ arg (... ...))
(abort-to-prompt tag arg (... ...))))))
exp exp* ...))
handler))))))
Then you can
(with-yield yield
(while #t ... (yield) ...))
Regards,
Andy
--
http://wingolog.org/
- Re: shift and reset, plus "while", Wolfgang J Moeller, 2011/04/04
- Re: shift and reset, plus "while", Andy Wingo, 2011/04/13
- Re: [shift and reset, plus] "while", Wolfgang J Moeller, 2011/04/13
- Re: [shift and reset, plus] "while", Andy Wingo, 2011/04/13
- Re: [shift and reset, plus] "while", Wolfgang J Moeller, 2011/04/13
- Re: [shift and reset, plus] "while",
Andy Wingo <=
- {debug,read,readline,print}-{set!,disable,enable}, Wolfgang J Moeller, 2011/04/29
Re: shift and reset, plus "while", Mark H Weaver, 2011/04/13
Re: shift and reset, plus "while", Andy Wingo, 2011/04/28