mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
Fix generator-find
This commit is contained in:
parent
41ba06aa5a
commit
043e4c2214
1 changed files with 2 additions and 4 deletions
|
@ -486,10 +486,8 @@
|
||||||
;; generator-find
|
;; generator-find
|
||||||
(define (generator-find pred g)
|
(define (generator-find pred g)
|
||||||
(let loop ((v (g)))
|
(let loop ((v (g)))
|
||||||
; A literal interpretation might say it only terminates on #eof if (pred #eof) but I think this makes more sense...
|
(and (not (eof-object? v))
|
||||||
(if (or (pred v) (eof-object? v))
|
(if (pred v) v (loop (g))))))
|
||||||
v
|
|
||||||
(loop (g)))))
|
|
||||||
|
|
||||||
|
|
||||||
;; generator-count
|
;; generator-count
|
||||||
|
|
Loading…
Add table
Reference in a new issue