From d595b9f26b3a971f97a58db25b8cf8d55fffe73c Mon Sep 17 00:00:00 2001 From: nathanmarz Date: Tue, 14 Feb 2017 14:33:46 -0500 Subject: [PATCH] change nthpath to richnav for performance --- src/clj/com/rpl/specter/navs.cljc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/clj/com/rpl/specter/navs.cljc b/src/clj/com/rpl/specter/navs.cljc index 8814153..e9692dc 100644 --- a/src/clj/com/rpl/specter/navs.cljc +++ b/src/clj/com/rpl/specter/navs.cljc @@ -506,15 +506,15 @@ (do-keypath-transform vals structure k next-fn) structure))) -(defnav nthpath* +(defrichnav nthpath* ^{:doc "Navigates to the given position in the sequence. Setting the value to NONE will remove it from the sequence. Works for all sequence types."} [i] - (select* [this structure next-fn] - (next-fn (nth structure i))) - (transform* [this structure next-fn] + (select* [this vals structure next-fn] + (next-fn vals (nth structure i))) + (transform* [this vals structure next-fn] (if (vector? structure) - (let [newv (next-fn (nth structure i))] + (let [newv (next-fn vals (nth structure i))] (if (identical? newv i/NONE) (i/srange-transform* structure i (inc i) (fn [_] [])) (assoc structure i newv))) @@ -523,7 +523,7 @@ i (inc i) (fn [[e]] - (let [v (next-fn e)] + (let [v (next-fn vals e)] (if (identical? v i/NONE) [] [v])