datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
Filipe Silva 2020-02-21T11:53:30.067400Z

@iagwanderson I'm not sure it's a bug or not

Filipe Silva 2020-02-21T11:53:49.067900Z

but I think what's happening is that conn-from-datoms is not the same as conn + transact!

Filipe Silva 2020-02-21T11:54:08.068400Z

rather, it's the same as getting all the datoms from an existing conn and giving them to another

Filipe Silva 2020-02-21T11:54:45.069200Z

and since an existing conn has no retractions expressed in its datom set, conn-from-datoms doesn't account for it

Filipe Silva 2020-02-21T11:55:01.069700Z

so maybe it's a bug, maybe not, depends on the intended semantics

Filipe Silva 2020-02-21T11:55:14.070100Z

I'd open an issue for it in your case and let the author chime in

Filipe Silva 2020-02-21T11:55:53.070700Z

if I had to bet, there isn't much of a reason to make conn-from-datoms behave as transactions though

Filipe Silva 2020-02-21T11:55:58.071Z

that would slow it down

Filipe Silva 2020-02-21T11:56:09.071300Z

and you can already just do transactions anyway

2020-02-21T15:05:37.071400Z

I'm using Roam Research, a web app for note taking with built in Datascript queries of your notes. It supports the where clause, but not in. I tried this:

[:find ?content
  :where
    [?e :node/title ?title]
    [(re-find #"February 21st" ?title)]
    [(parent ?a ?b)
      [?a :block/children ?b]]
    (parent ?e ?x)
    [?x :block/string ?content] 
]
The idea is to make a rule called parent that I can use in another rule called ancestor , allowing me to do recursive queries. But I get the following error:
Cannot parse binding, expected (bind-scalar | bind-tuple | bind-coll | bind-rel)

bartuka 2020-02-21T21:13:54.072400Z

@filipematossilva thanks for the explanation, I will make a small reproducible case for this scenario and open an issue to debate with more concrete information