vector-map should be run in the same dynamic environment when multiple return occurs

Issue #77 resolved
Takashi Kato repo owner created an issue

This test should be pass.

(let ([only-once #t]
      [v0 (vector 1 2 3 4 5 6)]
      [cl '()]
      [old-v1 #f])
  (let ([v1 (vector-map
         (lambda (e)
          (call/cc
           (lambda (c)
        (set! cl (cons c cl))
        (* e e))))
         v0)])
    (when only-once
      (set! only-once #f)
      (set! old-v1 v1)
      ((car (reverse cl)) 'x))
    (test-equal '#(1 2 3 4 5 6) v0)
    (test-equal '#(1 4 9 16 25 36) old-v1)
    (test-equal '#(x 4 9 16 25 36) v1)))

Found on Mosh repository: https://github.com/okuoku/mosh/commit/80664a98bd1cf9e699b691f92d270ebaa9b9e83b

Comments (1)

  1. Log in to comment