This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-23
Channels
- # babashka (15)
- # beginners (102)
- # biff (4)
- # calva (15)
- # cider (51)
- # clojure (5)
- # clojure-dev (3)
- # clojure-europe (3)
- # clojure-france (1)
- # clojure-india (1)
- # clojure-korea (2)
- # clojure-norway (13)
- # clojurescript (20)
- # data-science (1)
- # datalevin (6)
- # datascript (2)
- # emacs (3)
- # events (2)
- # fulcro (4)
- # gratitude (2)
- # introduce-yourself (8)
- # lsp (3)
- # malli (1)
- # meander (1)
- # nbb (9)
- # off-topic (11)
- # releases (1)
- # ring (1)
- # yamlscript (5)
Hi, how do I find records where opposite values of an attribute are a match. I want to find records where quantity 200 and -200 will match. it is right now giving me empty list as result
data [{:db/id -1
:date "2024/03/01"
:payee "Swiggy"
:quantity 200}
{:db/id -3
:date "2024/03/02"
:payee "Test"
:quantity 300}
{:db/id -4
:date "2024/03/02"
:payee "Test"
:quantity 300}
{:db/id -2
:date "2024/03/01"
:quantity -200
:payee "Swiggy"}]
f #(db/q '[:find
(pull ?t [*]) (pull ?t2 [*])
:in $
:where
[?t :quantity ?q]
[?t2 :quantity ?q2]
;; [(= (clojure.core/abs ?q) (clojure.core/abs ?q2))]
[(= ?q (clojure.core/* -1 ?q2))]
[(not= ?t ?t2)]]
%)
✅ 1