This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-07
Channels
- # announcements (4)
- # babashka (59)
- # beginners (26)
- # calva (34)
- # clj-kondo (3)
- # cljs-dev (1)
- # clojure (77)
- # clojure-austin (4)
- # clojure-europe (20)
- # clojure-nl (2)
- # clojure-norway (11)
- # clojure-spec (3)
- # clojure-uk (4)
- # clojurescript (103)
- # community-development (2)
- # cursive (15)
- # datalevin (12)
- # datascript (38)
- # datomic (1)
- # deps-new (2)
- # events (3)
- # figwheel-main (6)
- # fulcro (9)
- # honeysql (12)
- # jobs (4)
- # juxt (18)
- # kaocha (19)
- # lsp (42)
- # missionary (2)
- # pathom (14)
- # polylith (6)
- # portal (6)
- # reagent (8)
- # reitit (4)
- # releases (2)
- # shadow-cljs (17)
- # testing (1)
- # tools-deps (50)
- # vim (46)
- # xtdb (12)
Question re: datalog – Is there a possiblity to do and
matching to an input collection? :in [[?entity-id ...]]
matches entries as or
– I can just map with gensym
and conj those entries to the query but I was just wondering have I misunderstood something? 🙂
This is how it works like I expected – is there an easier way?
Hey @U32ST9GR5 I can't recall ever tackling a problem exactly this shape before, but I actually think your query generation is the only sane way to do this whilst working with the index and query engine mechanics (vs. pulling out collection values and calling clojure.set/subset?
predicates, or whatever)
I think your query can be simplified though - this pattern isn't need: [?user :xt/id ?user-id]
because the thing in the ID position is the ID. So ?user
and ?user-id
will be the exact same thing. Similarly for your [~skill-ent :xt/id ~skill-id]
- it shouldn't be needed. Reducing clauses should also boost performance as the query engine won't otherwise attempt to algebraically simplify such things
I suppose it's most similar to the Suduko-solver-in-XT-Datalog I wrote once (yet to publish as a blog post...), inspired by the general approach here http://conway.rutgers.edu/~ccshan/wiki/blog/posts/Sudoku_in_SQL/ - I did get it working, but it took me down a rabbit hole reflecting on pros/cons vs SMT solvers / core.logic / etc.
just browsing my gists and dug this out: https://gist.github.com/refset/3a848b1778f0af6fa43196a79b48f1db
could a [(subset? $ ?user :core/skill skills-set-in-parameter)]
type of predicate be made efficiently in user land?