I am using Datalevin 0.8.16 as a database for my application. I have inserted some data:
(datalevin.core/transact! conn
[{:hello "some value"
:data {:k "other value"}}])
Then running the query:
(datalevin.core/q
'[:find ?e ?v
:where [?e :hello ?v]
[?e :data ?d]
[(get ?d :k) ?v]]
my-db)
The result is #{[21 "other value"]}
.
I was expecting that the result set should have been empty, because usually the same ?v
variable cannot be bound to two different values.
Apparently, even though ?v
was bound to "some value"
, it re-bound to "other value"
in the following binding.
Is it expected behaviour or a bug? I did not found anything like this mentioned in the Datomic documentation of Function Expressions, and it calls the second parameter a binding to a variable, which should behave as regular bindings.