redplanetlabs / specter

Clojure(Script)'s missing piece
Apache License 2.0
2.51k stars 102 forks source link

Exception while using `before-index` #330

Open Samy-33 opened 3 months ago

Samy-33 commented 3 months ago

Reproduction steps:

(require '[com.rpl.specter :as s])

(->> [1 [2 2] 5 34]
       (s/setval [(s/nthpath 1) (s/before-index 2)] [])
       (s/setval [(s/nthpath 1) (s/before-index 2)] []))

Throws: No protocol method InsertBeforeIndex.insert-before-idx defined for type cljs.core/Subvec: [2 2 []]

Looks like the first s/setval converts [2 2] into a subvec instead of keeping it as vector.