clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
ghadi 2019-09-23T14:53:55.050400Z

there are a couple of avenues of things that are worth looking into for merge: transients && IReduceKV based impls

ghadi 2019-09-23T14:55:47.052200Z

Scala's new PHMs do merging based on the actual tree nodes themselves. Might be worth a look, too. Michael Steindorfer is the reference for those papers

ghadi 2019-09-23T14:56:26.052700Z

changing the impl of Map is a non-starter, imho

ghadi 2019-09-23T14:57:18.053500Z

there's some aborted work in a ticket on transients + map merge, but it needs more analysis

ghadi 2019-09-23T14:58:10.054400Z

one bounding constraint is that the conj operation (merge {:a :b} [:c :d]) remains valid

borkdude 2019-09-24T13:23:14.057500Z

why should that a bounding constraint? I've only seen this conj-y way of using merge in beginner's 4clojure solutions. I came across those when validating specs in https://github.com/borkdude/speculative. I've haven't come across this usage anywhere else.

borkdude 2019-09-24T13:24:34.057700Z

The docstring says merge is intended for maps.

borkdude 2019-09-24T13:27:35.058200Z

I know docstrings don't always paint the complete picture, but combined evidence ...

ghadi 2019-09-24T13:45:56.058400Z

compatibility

borkdude 2019-09-24T13:48:13.058600Z

some maybe it's better to introduce a merge2 then for the hypothetical case anyone was using (merge {} [:a 1])?

ghadi 2019-09-24T13:49:21.058800Z

it's not a hypothetical case, I've come across many usages in the wild

ghadi 2019-09-24T13:49:47.059Z

whether they were conscious about it, I can't say, but we can't break code

borkdude 2019-09-24T13:51:31.059200Z

right

ikitommi 2019-09-23T15:09:14.054800Z

;; 8ns
(cc/quick-bench
  (reduce-kv assoc {} {}))

ikitommi 2019-09-23T15:10:16.055100Z

thanks for the pointer, will check those out (out of common interest)

ghadi 2019-09-23T15:13:23.056600Z

The best immediate way to contribute to that ticket is a benchmark suite featuring arguments of different sizes & types to find the baselines.

👌 2