added "autorequire"; preparing libraries for autorequire
[k8-xscheme:k8-xscheme.git] / lib / tests / coro_test1.scm
1 (define (make-iterator list)
2   (make-coroutine
3     (lambda (yield)
4       (for-each yield list))))
5
6 (define (iterator-empty? iterator)
7   (iterator 'dead?))
8
9 (define my-iterator (make-iterator (list 1 2 3)))
10
11 (my-iterator)
12 ;1
13 (my-iterator)
14 ;2
15 (my-iterator)
16 ;3
17 (iterator-empty? my-iterator)
18 ;#f
19 (my-iterator)
20 ;dead
21 (iterator-empty? my-iterator)
22 ;#t