Fixing bug in iset-map.

This commit is contained in:
Alex Shinn 2014-05-19 07:08:39 +09:00
parent 1eeed831a5
commit 184b2aaf9f
2 changed files with 4 additions and 1 deletions

View file

@ -220,7 +220,7 @@
(apply iset-delete! (iset-copy iset) args))
(define (iset-map proc iset)
(iset-fold (lambda (i is) (iset-adjoin! is i)) (make-iset) iset))
(iset-fold (lambda (i is) (iset-adjoin! is (proc i))) (make-iset) iset))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; High-level set operations.

View file

@ -94,4 +94,7 @@
(test-assert (iset-contains? (iset-union a b) 119))
(test-assert (iset-contains? (iset-union b a) 119)))
(test '(2 3 4)
(iset->list (iset-map (lambda (i) (+ i 1)) (iset 1 2 3))))
(test-end)