Clojure

hashmaps: count is not always updated when associng/dissocing a nil key

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.1
  • Component/s: None
  • Labels:
    None
  • Approval:
    Ok

Description

user=> (count (reduce conj (hash-map) (for [i (range 30)] [i nil])))
0

Patch attached.

(thanks to danlarkin for reporting it http://clojure-log.n01se.net/date/2009-09-16.html#13:12 )

BTW, what's the best way to add specific tests such as this one to the test suite?

Activity

Hide
Assembla Importer added a comment -

cgrand said: [file:bOBpRYO1ar3PEPeJe5aVNr]: patch

Show
Assembla Importer added a comment - cgrand said: [file:bOBpRYO1ar3PEPeJe5aVNr]: patch
Hide
Assembla Importer added a comment -

fsodomka said: Concerning the test: In the past we were adding tests directly to the other tests for the given function. I would just add it in the test-count in data_structures.clj.

; associng/dissocing a nil key - ticket #192
(is (= 30 (count (reduce conj (hash-map) (for [i (range 30)] [i nil])))))

Show
Assembla Importer added a comment - fsodomka said: Concerning the test: In the past we were adding tests directly to the other tests for the given function. I would just add it in the test-count in data_structures.clj. ; associng/dissocing a nil key - ticket #192 (is (= 30 (count (reduce conj (hash-map) (for [i (range 30)] [i nil])))))

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: