This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-15
Channels
- # announcements (11)
- # beginners (66)
- # boot (6)
- # clara (25)
- # cljdoc (4)
- # cljs-dev (22)
- # clojure (261)
- # clojure-dev (1)
- # clojure-europe (2)
- # clojure-italy (15)
- # clojure-losangeles (1)
- # clojure-nl (19)
- # clojure-spec (62)
- # clojure-uk (50)
- # clojurescript (12)
- # community-development (6)
- # cursive (60)
- # datomic (21)
- # emacs (2)
- # figwheel (2)
- # figwheel-main (3)
- # fulcro (2)
- # graphql (11)
- # hyperfiddle (11)
- # javascript (1)
- # jobs (6)
- # juxt (1)
- # kaocha (5)
- # keechma (2)
- # off-topic (4)
- # onyx (10)
- # pathom (7)
- # re-frame (15)
- # reagent (8)
- # remote-jobs (2)
- # ring-swagger (14)
- # shadow-cljs (35)
- # sql (22)
- # testing (9)
- # tools-deps (62)
- # vim (12)
Is it possible to develop ions using a standalone/local datomic (in memory or otherwise) DB? (I don't always have internet access when programming 🚌)
i was thinking about this the other day, but i don’t know. if i had to guess, no. we’re working with something called “_ cloud” which i figure is a pretty good excuse to not have an offline story
@U5QE6HQK0 I mean, you can develop your codebase, you just can’t connect to the database. If you wanted to mock things out you practice tdd to work on Biz Logic.
i've got some attributes like the following:
{:response/id 4
:response/items [...]
:response/request {:request/id 4
:request/items [...]}}
and i'm trying to query for response/request pairs where the item counts are different. ie, the request talked of 5 items but the response talks only of 2.
My first stab at it has been like so
(d/q '[:find ?request
:in $
:where
[?response :response/items ?resp-items]
[(count ?resp-items) ?resp-item-count]
[?response :response/request ?request]
[?request :request/items ?req-items]
[(count ?req-items) ?req-item-count]
[(!= ?resp-item-count ?req-item-count)]]
db)
but this is trying to take the count of a long
which makes sense but i'm not sure how to tweak it to count the collectionEvery clause operates on each individual element that matches a given logic variable. So you’re counting the entityIDs (which are bound to resp-items)
examples: https://forum.datomic.com/t/subquery-examples/345 and https://stackoverflow.com/questions/23215114/datomic-aggregates-usage/30771949#30771949
doesn’t look like it’s trying to take the count of a long? are you getting any errors or just no results?
Datomic 0.9.5786 is now available https://forum.datomic.com/t/datomic-0-9-5786-now-available/696
here’s a naive little utility fn for pull expressions that I find myself reaching for during development. let me know if there’s another (likely better and more full) implementation out there! https://gist.github.com/uwo/9ae7a83737093dd59b6a1c6086cc0837
I'm not clear on the input to this. You give it the result of a pull (maps of keywords to vectors-of-maps) and it gives you the pull expression that would pull the same data?
Here is something similar: pulled-tree-derivative https://github.com/hyperfiddle/hyperfiddle/blob/master/src/contrib/datomic.cljc#L69 and test case https://github.com/hyperfiddle/hyperfiddle/blob/master/test/contrib/datomic_test.cljc#L81-L85
As to whether to drive datomic utils by polymorphism or by schema, I have learned the hard way to just always use schema and stop thinking about it. There are too many edge cases. We have a whole graveyard of implementations with comments like "todo isComponent" and "todo lookup refs" etc.
@U09R86PA4 yep. for some reason I often have a concrete tree of data on hand and don’t want to spend a bunch of time writing the pull expression that would generate it. It usually just serves as a starting point, not something I do dynamically in production code
thanks @U09K620SG !
Here is something similar: pulled-tree-derivative https://github.com/hyperfiddle/hyperfiddle/blob/master/src/contrib/datomic.cljc#L69 and test case https://github.com/hyperfiddle/hyperfiddle/blob/master/test/contrib/datomic_test.cljc#L81-L85
As to whether to drive datomic utils by polymorphism or by schema, I have learned the hard way to just always use schema and stop thinking about it. There are too many edge cases. We have a whole graveyard of implementations with comments like "todo isComponent" and "todo lookup refs" etc.