This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-17
Channels
- # alda (5)
- # bangalore-clj (1)
- # beginners (9)
- # bigdata (1)
- # boot (51)
- # carry (1)
- # cider (9)
- # cljs-dev (22)
- # clojars (39)
- # clojure (118)
- # clojure-brasil (1)
- # clojure-czech (8)
- # clojure-france (2)
- # clojure-italy (5)
- # clojure-korea (9)
- # clojure-russia (9)
- # clojure-spec (17)
- # clojure-uk (42)
- # clojurescript (48)
- # core-async (1)
- # emacs (3)
- # figwheel (1)
- # funcool (3)
- # hoplon (39)
- # klipse (51)
- # lein-figwheel (4)
- # leiningen (2)
- # luminus (5)
- # off-topic (245)
- # om (18)
- # onyx (19)
- # parinfer (1)
- # pedestal (18)
- # re-frame (47)
- # reagent (19)
- # ring-swagger (1)
- # specter (18)
- # untangled (93)
- # vim (8)
- # yada (56)
@nahuel You can just do (transform :a #(dissoc % :b) data)
I have a utility function to help with it: (defn dissocer [k] (fn [m] (dissoc m k)))
so you can do (transform :a (dissocer :b) data)
there's also some thought about extending ALL
and keypath
to be able to remove elements on this issue https://github.com/nathanmarz/specter/issues/117
but you could always just make your own navigator with that functionality
why this doesnt work? (setval [:a #{1 2} ] :y {:a {1 :z 2 :z 3 :z }}) .. I expected {:a {1 :y, 2 :y, 3 :z}} but the map is unchanged (I'm trying to use the set as a predicate)
sets are interpreted as filter predicates
(#{1 2} {1 :z 2 :z 3 :z })
is false, so it stops navigation at that point
@nahuel you should do this: (setval [:a (multi-path (keypath 1) (keypath 2))] :y {:a {1 :z 2 :z 3 :z }})
probably the easiest is to do (setval [:a (apply multi-path #{1 2})] ...)
mm, my set can be very big, I think there is some limitation for apply on the number of arguments
there's not
(apply + (range 100000))
=> 4999950000
actually the code I gave you isn't quite right, it should be (setval [:a (apply multi-path (map keypath #{1 2}))] ...)