This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-30
Channels
- # announcements (15)
- # beginners (99)
- # boot (15)
- # cider (105)
- # cljdoc (2)
- # cljs-dev (17)
- # clojure (132)
- # clojure-conj (1)
- # clojure-dev (5)
- # clojure-italy (19)
- # clojure-losangeles (2)
- # clojure-nl (20)
- # clojure-spec (70)
- # clojure-uk (50)
- # clojurescript (153)
- # core-logic (9)
- # cryogen (4)
- # cursive (6)
- # datomic (40)
- # duct (5)
- # figwheel-main (10)
- # fulcro (245)
- # hoplon (1)
- # jobs (3)
- # leiningen (12)
- # mount (8)
- # nrepl (11)
- # off-topic (1)
- # pathom (16)
- # pedestal (3)
- # planck (17)
- # re-frame (3)
- # reitit (8)
- # shadow-cljs (64)
- # spacemacs (3)
- # specter (20)
- # tools-deps (21)
is there a better way to construct this path? maybe something involving recursive-path
?
(defn tag-path [& tag-names]
(apply
concat
(interpose
[ALL]
(map
#(vector (selected? :tag (pred= %)) :value)
tag-names))))
(tag-path "EA" "C1") => [(selected? :tag (pred= "EA")) :value ALL (selected? :tag (pred= "C1")) :value]
@schmee dynamic navs will dramatically increase performance when tag-path
is called with dynamic params (eg. a local variable)
(defdynamicnav tag-path [& tag-names]
(let [late-pred= (late-resolved-fn pred=)]
(apply
concat
(interpose
[ALL]
(map
#(vector (selected? :tag (late-pred= %)) :value)
tag-names)
))))
things like this are where you get huge speedup:
(defn f [a data]
(select (tag-path a "b") data)
)
not very much documentation on them, just this https://github.com/nathanmarz/specter/wiki/Specter%27s-inline-caching-implementation
yes, it's fine
all that logic only ever executes once per callsite
because of dynamicnav
you've now delved into the most advanced part of specter ;)
let me know if you have questions
@schmee no, but it's easy to make a custom navigator with that functionality
see defrichnav