Re: [BUG] : clojure.data/diff handles nested empty collections incorrectly

2015-02-23 Thread Timothy Pratley
Hi Andy, Having thunk on it, I will try to articulate my preference for nil over {} more clearly: (clojure.data/diff {:x {:y 1}} {:x {}}) ;; => ({:x {:y 1}} {:x nil} nil) Do you agree the current result is wrong? :x nil is not 'in' {:x {}} nil is not associative so in this context does not mea

Re: [BUG] : clojure.data/diff handles nested empty collections incorrectly

2015-02-22 Thread Raymond Huang
Not trying to hijack this thread, @andy check out Differential Sync. On Sat, Feb 21, 2015, 4:36 PM Andy Fingerhut wrote: > Sorry if you've already explained this and I'm missing it, but for > example, suppose the current state on both sides is {:x {:y 1}}, and the > 'sender' wants to change to o

Re: [BUG] : clojure.data/diff handles nested empty collections incorrectly

2015-02-21 Thread Andy Fingerhut
Sorry if you've already explained this and I'm missing it, but for example, suppose the current state on both sides is {:x {:y 1}}, and the 'sender' wants to change to one of these states: (a) {:x nil} (b) {:x {}} (b) {:x []} (c) {:x {:y nil}} Do you plan to support sending a different 'diff' in

Re: [BUG] : clojure.data/diff handles nested empty collections incorrectly

2015-02-20 Thread Timothy Pratley
Hi Andy, On Fri, Feb 20, 2015 at 5:51 PM, Andy Fingerhut wrote: > The goal with your library is to transmit deltas between two systems, and > then apply those deltas to the other system to make them match, yes? > Correct, it works well for what I need it to do. :) > How would you use the dif

Re: [BUG] : clojure.data/diff handles nested empty collections incorrectly

2015-02-20 Thread Andy Fingerhut
The goal with your library is to transmit deltas between two systems, and then apply those deltas to the other system to make them match, yes? How would you use the diff return value ({:x {:y 1}} nil nil) to cause a system that currently has {:x {:y 1}} to change to {:x {}}, as opposed to some oth

Re: [BUG] : clojure.data/diff handles nested empty collections incorrectly

2015-02-20 Thread Timothy Pratley
On Fri, Feb 20, 2015 at 4:40 PM, Andy Fingerhut wrote: > Why not ({:x {:y 1}} {:x {}} nil) ? > Hi Andy, Great point! Both solutions convey accurately the same meaning? I have a subjective preference to nil as the absence of things in b that are not in a. Conversely {:x {}} implies that :x is

Re: [BUG] : clojure.data/diff handles nested empty collections incorrectly

2015-02-20 Thread Andy Fingerhut
Timothy, I probably haven't thought about this carefully enough yet, but why do you expect the return value to be ({:x {:y 1}} nil nil) in your test case? Why not ({:x {:y 1}} {:x {}} nil) ? Andy On Fri, Feb 20, 2015 at 4:13 PM, Timothy Pratley wrote: > Alex/Rich, if a patch is welcome for th

[BUG] : clojure.data/diff handles nested empty collections incorrectly

2015-02-20 Thread Timothy Pratley
Alex/Rich, if a patch is welcome for this I am happy to raise a ticket and submit. Test case: (clojure.data/diff {:x {:y 1}} {:x {}}) Expected: ({:x {:y 1}} nil nil) Actual: ;; => ({:x {:y 1}} {:x nil} nil) Problem: There is nothing only in the second input, so the second result should be nil