[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
continuation?
From: |
Bill Schottstaedt |
Subject: |
continuation? |
Date: |
Sun, 25 May 2003 04:58:50 -0700 |
Why doesn't Scheme have "continuation?"? Here's a
toy example:
(catch 'got-c-g
(lambda ()
(do ((i 0 (1+ i)))
((= i 100))
(if (c-g?) ; returns #t if C-g was typed
(call-with-current-continuation
(lambda (return)
(throw 'got-c-g return))))
(display (format #f "back again: ~A" i))
(sleep 1)))
(lambda args
(display (format #f "caught C-g: ~A" args))
(if (continuation? (cadr args))
((cadr args) #f))))
It's not hard to implement in Guile; something like:
SCM_BOOL (SCM_NIMP (obj) && (SCM_CONTINUATIONP (obj)))
- continuation?,
Bill Schottstaedt <=