This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-25
Channels
- # aleph (15)
- # beginners (65)
- # boot (46)
- # chestnut (3)
- # cider (1)
- # clara (11)
- # cljs-dev (5)
- # cljsjs (4)
- # cljsrn (13)
- # clojure (180)
- # clojure-dev (2)
- # clojure-italy (10)
- # clojure-russia (62)
- # clojure-spec (6)
- # clojure-uk (85)
- # clojurescript (45)
- # community-development (11)
- # crypto (3)
- # cursive (10)
- # datomic (94)
- # defnpodcast (2)
- # fulcro (4)
- # heroku (1)
- # hoplon (4)
- # jobs (3)
- # juxt (10)
- # leiningen (1)
- # luminus (4)
- # mount (13)
- # music (1)
- # off-topic (10)
- # onyx (2)
- # portkey (15)
- # proton (2)
- # re-frame (16)
- # reagent (10)
- # shadow-cljs (194)
- # spacemacs (2)
- # specter (2)
I have this clause in an LHS:
[?last-performed-date <- (acc/max :date)
:from [fact/test-result
(= ?test-id test-id)]]
Because the initial value of the max accumulator is nil, it never fires when there are no test-result facts. Am I missing some idiomatic way to have it fire in that case? Do I need to write my own accumulator with a different initial value? Can I do this with :or?since acc/max
doesn’t necessarily make sense for no facts - that may not always be the behavior that was desired
[?last-performed-date <- (assoc (acc/max :date) :initial-value <my-date>)
:from [fact/test-result
(= ?test-id test-id)]]
not sure it will always be clear what happened though@mikerod thanks--I ended up adding an [:or ... [:not [fact/test-result (= ?test-id test-id)]]]
1
Is there a way to use accumulate with multiple fact_contraints? For example, if I have the facts
{:e 2, :a :type, :v :dog}
{:e 2, :a :age, :v 12}
{:e 3, :a :type, :v :cat}
{:e 3, :a :age, :v 2}
{:e 4, :a :type, :v :dog}
{:e 4, :a :age, :v 10}
I would like to acc/all :type facts, matching :type is :dog and :age > 4. The :fact-type-fn is :a.[:type
(= (:v this) :dog)
(= ?id (:e this))]
[?all <- (acc/all)
:from [:age
(= ?id (:e this))
(> (:v this) 4)]
@nickowsy perhaps?