for/stream can use #:break as advertised (fixes #1910)
This commit is contained in:
parent
390977c1de
commit
2e1a81b345
|
@ -62,4 +62,9 @@
|
|||
(test 1 'for/stream (stream-first (for*/stream ([x '(1 0)]) (/ x))))
|
||||
(test 625 'for/stream (stream-ref (for/stream ([x (in-naturals)]) (* x x)) 25))
|
||||
|
||||
(test '(0 1 2 3 4 5) stream->list (for/stream ([i (in-naturals)] #:break (> i 5)) i))
|
||||
(test '(0 1 2 3 4 5) stream->list (for/stream ([i (in-naturals)]) #:break (> i 5) i))
|
||||
(test '(0 1 2 3 4 5) stream->list (for/stream ([i (in-naturals)])
|
||||
(define ii (sqr i)) #:break (> ii 30) i))
|
||||
|
||||
(report-errs)
|
||||
|
|
|
@ -317,10 +317,12 @@
|
|||
(raise-syntax-error (syntax-e #'derived-stx)
|
||||
"missing body expression after sequence bindings"
|
||||
stx #'body))
|
||||
#`(sequence->stream
|
||||
(in-generator
|
||||
(#,derived-stx #,stx () clauses
|
||||
(yield (let () . body))
|
||||
(values)))))]))
|
||||
(with-syntax ([((pre-body ...) body*) (split-for-body stx #'body)])
|
||||
#`(sequence->stream
|
||||
(in-generator
|
||||
(#,derived-stx #,stx () clauses
|
||||
pre-body ...
|
||||
(yield (let () . body*))
|
||||
(values))))))]))
|
||||
(values (make-for/stream #'for/fold/derived)
|
||||
(make-for/stream #'for*/fold/derived))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user