On Fri, 2012-01-13 at 09:03 -0800, vitalyper wrote:
> Clojure> (diff ["a" "b" "c"] ["c" "d"])
> [["a" "b" "c"] ["c" "d"] nil]
> 
> Looks like the result doesn't match documentation:
> "Recursively compares a and b, returning a tuple of
> [things-only-in-a things-only-in-b things-in-both]."

It does match the detail, which refines the above:

> * All sequential things are treated as associative collections
> by their indexes, with results returned as vectors.
> 
In other words, diffing is key-sensitive, and seqs have keys 0, 1, ...
Compare:

user=> (diff ["a" "b" "c"] ['q 'q "c" "d"])
[["a" "b"] [q q nil "d"] [nil nil "c"]]

(With nils because you can't skip 0 to get to 1, etc.)

-- 
Stephen Compall
^aCollection allSatisfy: [:each|aCondition]: less is better

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to