datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
jbrown 2019-11-12T07:28:56.027Z

Here's the repo https://github.com/panterarocks49/datascript-firebase

2019-11-12T18:32:42.031300Z

I'm wondering about the possibility of implementing a first class sequential list type in datascript. I've read https://github.com/tonsky/datascript/wiki/Tips-&-tricks#preserving-order and understand there are ways around it, but if I wanted to fork datascript and implement a real list type, definable in a schema, is there a fundamental reason that is either hard or a bad idea? Or is the lack of lists more to mirror the featureset of datomic?

lilactown 2019-11-12T18:40:53.032Z

what’s the upside of adding it to data script over querying, then sorting? or adding a vec or list?

2019-11-12T18:54:13.033500Z

mainly because an attribute is logically sequential it would be nice to be able to lean on the schema to manage this rather than have to manage it myself in code (either by sorting or manually appending to a list)

2019-11-12T18:55:19.034600Z

I'm sure this alone doesn't justify maintaining a separate version of DS, just kind of curious at this point if there are major limitations

jbrown 2019-11-12T19:55:36.036900Z

I would personally love something like this. Particularly updating orders in a ref-many list is quite annoying. But I don't think I would switch from ds to a fork, would have to be a wrapper

2019-11-12T20:49:14.039100Z

@jjttjj Have you looked at the new Datomic tuple support? Seems like that's more or less what you want, with some tx-functions to manage things like "append".

2019-11-12T20:49:34.039500Z

Note: tuple is much more generally useful, as it lets you do things like compound indexes.

2019-11-12T21:08:13.040200Z

Tuples seem interesting and I will have to more thoroughly research them, but from an initial look it seems they can contain at most 8 values which isn't suitable for my use case

2019-11-12T22:21:21.040500Z

Datomic and datascript are fundamentally a relational set based model, which just works more elegantly if you normalize (break your list apart, store as separate rows/datoms). If you leave your collection inline, you won't get as nice indices for certain kinds of queries

2019-11-12T22:29:30.040700Z

https://www.postgresql.org/docs/10/gin-intro.html might be useful reading for adding an index that works for composite types

👍 1