Fork me on GitHub
#specter
<
2016-11-11
>
nathanmarz11:11:07

@zane I haven't dug that much into Spec yet, care to show an example of what you mean?

imre13:11:09

I would be grateful if someone could give me advice on building paths dynamically using a navigator in 0.13.1

imre13:11:27

my navigator is like this

imre13:11:31

(sp/defnav
  EID
  [eid]
  (select* [{:keys [eid]} structure next-fn] (eid-nav-select* eid structure next-fn))
  (transform* [{:keys [eid]} structure next-fn] (eid-nav-transform* eid structure next-fn)))

imre13:11:40

and this is how I try to build a path from a list of keys

imre13:11:43

(defn- specter-path [ks]
  (map #(if (u/uuid? %)
          (EID %)
          %)
       ks))

imre13:11:08

and getting a Cannot statically combine sequential when not in nav pos error when invoking specter-path

imre13:11:00

well actually the error comes when I try to use the path in a call to setval

imre14:11:07

well, I managed to fix it however I don't exactly know why it failed.

imre14:11:16

so the calling code looked like this:

imre14:11:36

(-> (concat [:_entity] ks)
          specter-path
          (sp/setval value stored-entity))

imre14:11:58

but when I defined this function

(defn- setval [apath aval structure]
  (sp/setval apath aval structure))
and replaced sp/setval with setval inside the threading macro, it worked

nathanmarz14:11:18

@imre that looks like a bug

nathanmarz14:11:30

can you open an issue on github for it?

nathanmarz14:11:55

you can workaround it by doing (let [p (specter-path ...)] (setval p ...))

imre14:11:49

thanks @nathanmarz I'll open one - is it okay if I just put this chatlog in there?

imre14:11:56

and btw specter absolutely rocks