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?Looks like you did not require the namespace properly
I did require [com.rpl.specter :as s :refer-macros [setval]]
, do I need more?
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... https://github.com/redplanetlabs/specter#clojurescript
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: https://github.com/redplanetlabs/specter/pull/292
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 🙈
I don't see that in the readme
You're right, that's just wrong
(setval [:a END] [4 5] data)
That's the exampleTurns 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 😅
It happens :man-shrugging: