[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
shift and reset in ice-9 control
From: |
Andy Wingo |
Subject: |
shift and reset in ice-9 control |
Date: |
Thu, 17 Mar 2011 11:53:31 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hello again Wolfgang,
On Wed 09 Mar 2011 11:53, Wolfgang J Moeller <address@hidden> writes:
> ;;; -*- scheme -*-
> ;;
> ;;; try reset & shift with GUILE V2 prompts
> ;;
> ;;
> (define-syntax reset
> (syntax-rules ()
> ((_ . body)
> (call-with-prompt 'Reset
> (lambda () . body)
> (lambda (cont f) (f cont))))))
> ;;
> (define-syntax shift
> (syntax-rules ()
> ((_ var . body)
> (abort-to-prompt 'Reset
> (lambda (cont)
> ((lambda (var) (reset . body))
> (lambda vals (reset (apply cont vals)))))))))
> ;;
> ;;
> (define (reset* thunk)
> (reset (thunk)))
> ;;
> (define (shift* fc)
> (shift c (fc c)))
Did you write these yourself? May we include them in (ice-9 control)?
If you have additional useful tests, we are happy to include them as
well. Probably the easiest thing would be to mail them to the list with
a permissive copyright header.
Cheers,
Andy
--
http://wingolog.org/
- guile 2.0.0 crash related to call-with-prompt/abort-to-prompt, & more, Wolfgang J Moeller, 2011/03/09
- Re: guile 2.0.0 crash related to call-with-prompt/abort-to-prompt, & more, Andy Wingo, 2011/03/11
- Re: guile 2.0.0 crash related to call-with-prompt/abort-to-prompt, & more, Andy Wingo, 2011/03/14
- Re: guile 2.0.0 crash related to call-with-prompt/abort-to-prompt, & more, Andy Wingo, 2011/03/15
- shift and reset in ice-9 control,
Andy Wingo <=