Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent return types in clojure.data/diff tuple #296

Open
kennyjwilli opened this issue May 6, 2019 · 1 comment
Open

Inconsistent return types in clojure.data/diff tuple #296

kennyjwilli opened this issue May 6, 2019 · 1 comment

Comments

@kennyjwilli
Copy link
Contributor

@kennyjwilli kennyjwilli commented May 6, 2019

I expected the result of diff to be a tuple of a list of Datoms or nil for things-only-in-a, things-only-in-b, and things-in-both. things-in-both is allowed to be a list of Datoms, nil, or a DB. Is this expected?

Expected return type
Actual return type:
[([datascript/Datom] | nil) ([datascript/Datom] | nil) ([datascript/Datom] | nil) ]

Actual return type
[([datascript/Datom] | nil) ([datascript/Datom] | nil) ([datascript/Datom] | datascript/DB | nil) ]

Examples

(clj-data/diff
  (d/db-with (d/empty-db) [])
  (d/db-with (d/empty-db) []))
=> [nil nil #datascript/DB{:schema nil, :datoms []}]
(clj-data/diff
  (d/db-with (d/empty-db) [{:a "a"}])
  (d/db-with (d/empty-db) [{:a "a"}]))
=> [nil nil #datascript/DB{:schema nil, :datoms [[1 :a "a" 536870913]]}]
(clj-data/diff
  (d/db-with (d/empty-db) [{:a "a"}])
  (d/db-with (d/empty-db) [{:a "a"}
                           {:b "b"}]))
=> [nil [#datascript/Datom[2 :b "b" 536870913 true]] [#datascript/Datom[1 :a "a" 536870913 true]]]
@tonsky
Copy link
Owner

@tonsky tonsky commented May 7, 2019

Good catch! No, this is not expected. Probably a bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.