Fork me on GitHub

Hi, I'm trying to use specter in cljs, but I can't get it to work. Even for examples from the tutorial, I get:

(setval {:a [1 2 3]} [:a s/END] [4 5])
Error: No protocol method ImplicitNav.implicit-nav defined for type cljs.core/PersistentArrayMap: {:a [1 2 3]}
Am I doing something wrong?

Jeff Evans13:02:50

Looks like you did not require the namespace properly


I did require [com.rpl.specter :as s :refer-macros [setval]] , do I need more?

Jeff Evans17:02:27

I think you don't want to use refer-macros. Use prefix qualification for setval. CLJS doesn't have access to macros at runtime.


Hm, thanks for the support, I looked into it, but I don't think that's it, that's more or less exactly the line recommended in the spectre README...

Jeff Evans20:02:57

Oh actually, different problem. There is no implicit navigator for maps like that. Not sure where your snippet came from but it's not a valid navigator. See, ex:


The example is also taken verbatim from the readme... Maybe you could explain a bit how implicit navigators work and what they're needed for? I thought my path was pretty explicit :D


Oh, nvm, I messed up the order 🙈

Jeff Evans20:02:57

I don't see that in the readme


You're right, that's just wrong


(setval [:a END] [4 5] data)
That's the example


Turns out, if you do it correctly, it works! Who would've thought. Thank you for pointing it out, not sure how I overlooked that, stared at the line several times. Probably not having a good day 😅

Jeff Evans20:02:07

It happens :man-shrugging:

thanks3 3