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)
)
nice! I haven’t delved into dynamic navs yet, I’ll check them out!
but would you say that is an OK way to write the tag-path
function?
with all the interpose and apply and whatnot…
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
excellent, thanks for the help as always
you've now delved into the most advanced part of specter ;)
let me know if you have questions
will do!
is there any way to get access to collected values in view
?
@schmee no, but it's easy to make a custom navigator with that functionality
see defrichnav
:thumbsup: