in-indexed: repair call to wrapped continue-after-pos+val?

Closes #2418
This commit is contained in:
Matthew Flatt 2018-12-09 12:27:29 -07:00
parent 24aeea28c1
commit 140043fb65
2 changed files with 18 additions and 1 deletions

View File

@ -98,6 +98,23 @@
(test-sequence [(a b c) (0 1 2)] (in-indexed '(a b c)))
;; Make sure `in-indexed` doesn't provide a bad position to the underlying
;; sequence
(let ()
(define pre-poss '())
(define post-poss '())
(define naturals-sequence
(make-do-sequence (thunk (values identity
add1
1
(lambda (pos) (set! pre-poss (cons pos pre-poss)) #t)
#f
(lambda (pos val) (set! post-poss (cons pos post-poss)) #t)))))
(let-values (((next? next) (sequence-generate (in-indexed naturals-sequence))))
(for ((n 3)) (next)))
(test '(3 2 1) values pre-poss)
(test '(2 1) values post-poss))
(let ()
(define (counter) (define n 0) (lambda ([d 1]) (set! n (+ d n)) n))
(test-sequence [(1 2 3 4)] (for/list ([x (in-producer (counter))] [y (in-range 4)]) x))

View File

@ -1133,7 +1133,7 @@
(and pre-cont?
(lambda (val idx) (pre-cont? val)))
(and post-cont?
(lambda (pos val idx) (post-cont? pos val))))))))
(lambda (pos val idx) (post-cont? (car pos) val))))))))
(define (in-value v)
(make-do-sequence (lambda ()