Closed yuhan0 closed 6 months ago
Tests for the new transducer arities haven't been written yet, is it alright to simply duplicate the test cases in a (into {})
form? eg.
(deftest test-map-keys
(is (= (map f coll)
expected)))
=>
(deftest test-map-keys
(testing "maps"
(is (= (m/map-keys f coll)
expected)))
(testing "transducers"
(is (= (into {} (m/map-keys f) coll)
expected))))
I pushed the requested changes and added simple "duplicate" tests of the existing ones (they all pass), let me know if you'd like the commits to be squashed in a particular way.
I've considered this, but on reflection I don't think I want the map functions in Medley to support transducers.
See discussion in #12
Add a 1-argument arity to the following functions, which returns a transducer consuming and producing a sequence of [key value] map-entry pairs, and can be used to construct a map using (into {} xform coll).
index-byThe second commit refactors out repeated code into a private
completing-rf
function, if needed this can be omitted or squashed into the previous one.