juji-io / editscript

A library to diff and patch Clojure/ClojureScript data structures
Eclipse Public License 1.0
485 stars 23 forks source link

Suboptimal edit? #16

Closed eneroth closed 4 years ago

eneroth commented 4 years ago

In this diff:

(def a [:zero {:x :y}])
(def b [:zero {:a "a" :b "b" :c "c" :d "d" :e "e"}])

(diff a b))

=> [[[1] :-] [[1] :+ {:a "a", :b "b", :c "c", :d "d", :e "e"}]]

… it seems like removing and adding would be suboptimal. Wouldn't replacing be a smaller solution?

[[[1] :r {:a "a", :b "b", :c "c", :d "d", :e "e"}]]
huahaiy commented 4 years ago

Thanks for reporting. I will look into this later.

huahaiy commented 4 years ago

Fixed in 0.4.4