FM <danfm@dartmouth.edu> wrote:
+---------------
| but something like this isn't so trivially transformed:
|
| (let ((x 1))
| (defun gen ()
| (incf x))
| (defun gen2 ()
| (decf x)))
+---------------
The usual [albeit somewhat ugly] Scheme idiom for this is:
(define gen 'notyet)
(define gen2 'notyet)
(let ((x 1))
(set! gen (lambda () (set! x (+ x 1)) x))
(set! gen2 (lambda () (set! x (- x 1)) x)))
-Rob
-----
Rob Warnock, 31-2-510 rpw3@sgi.com
Network Engineering http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673
1600 Amphitheatre Pkwy. PP-ASEL-IA
Mountain View, CA 94043