specter

Latest version: 1.1.3
2021-02-20T09:34:33.001300Z

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?

2021-02-20T13:06:50.002100Z

Looks like you did not require the namespace properly

2021-02-20T17:02:04.002700Z

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

2021-02-20T17:32:27.003600Z

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

2021-02-20T20:15:58.005200Z

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

2021-02-20T20:20:57.007Z

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

2021-02-20T20:22:58.008200Z

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

2021-02-20T20:23:51.008700Z

Oh, nvm, I messed up the order 🙈

2021-02-20T20:23:57.009Z

I don't see that in the readme

2021-02-20T20:23:58.009100Z

You're right, that's just wrong

2021-02-20T20:24:09.009300Z

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

2021-02-20T20:25:41.010300Z

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 😅

2021-02-20T20:40:07.011Z

It happens :man-shrugging:

1