This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-29
Channels
- # announcements (6)
- # beginners (110)
- # calva (18)
- # clj-kondo (19)
- # cljs-dev (27)
- # clojars (10)
- # clojure (38)
- # clojure-art (2)
- # clojure-europe (13)
- # clojure-germany (1)
- # clojure-norway (26)
- # clojure-uk (2)
- # clojurescript (10)
- # conjure (9)
- # cursive (12)
- # data-science (3)
- # datomic (22)
- # emacs (8)
- # helix (9)
- # honeysql (18)
- # introduce-yourself (1)
- # jobs (1)
- # leiningen (8)
- # lsp (22)
- # missionary (9)
- # nbb (11)
- # off-topic (83)
- # pathom (5)
- # pedestal (4)
- # polylith (1)
- # portal (1)
- # re-frame (3)
- # reitit (15)
- # remote-jobs (1)
- # rum (4)
- # shadow-cljs (88)
- # specter (12)
- # testing (1)
- # vim (39)
given
[{:id 1
:some {:nested {:value 11}}}
{:id 2
:some {:nested {:value 3}}}]
I want to remove all top-level objects where [:some :nested :value]
is greater than 10. How do I do that?not correct:
(transform
(subselect ALL :some :nested :value #(> % 10))
NONE
data)
gives:
[{:id 1, :some {:nested {}}} {:id 2, :some {:nested {:value 3}}}]
but I want:
[{:id 2, :some {:nested {:value 3}}}]
this is close, but I feel I’m missing something
(transform
[ALL (fn [x]
(> (-> x :some :nested :value) 10))]
NONE
data)
=> [nil {:id 2, :some {:nested {:value 3}}}]
this does what i need:
(setval
[ALL (fn [x]
(> (-> x :some :nested :value) 10))]
NONE
data)
but I am expecting there to be something
I can replace the function with. like:
(setval
[ALL (something [:some :nested :value #(> % 10)])]
NONE
data)
aha pred
I see. why empty vector?
hmm, have to think on this. still don’t grok this. thanks!
but i'm surprised that (setval (subselect ALL :some :nested :value (pred> 10)) [] data)
doesn't work though