change nthpath to richnav for performance
This commit is contained in:
parent
71ed0ffae9
commit
d595b9f26b
1 changed files with 6 additions and 6 deletions
|
|
@ -506,15 +506,15 @@
|
||||||
(do-keypath-transform vals structure k next-fn)
|
(do-keypath-transform vals structure k next-fn)
|
||||||
structure)))
|
structure)))
|
||||||
|
|
||||||
(defnav nthpath*
|
(defrichnav nthpath*
|
||||||
^{:doc "Navigates to the given position in the sequence. Setting the value to NONE
|
^{: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."}
|
will remove it from the sequence. Works for all sequence types."}
|
||||||
[i]
|
[i]
|
||||||
(select* [this structure next-fn]
|
(select* [this vals structure next-fn]
|
||||||
(next-fn (nth structure i)))
|
(next-fn vals (nth structure i)))
|
||||||
(transform* [this structure next-fn]
|
(transform* [this vals structure next-fn]
|
||||||
(if (vector? structure)
|
(if (vector? structure)
|
||||||
(let [newv (next-fn (nth structure i))]
|
(let [newv (next-fn vals (nth structure i))]
|
||||||
(if (identical? newv i/NONE)
|
(if (identical? newv i/NONE)
|
||||||
(i/srange-transform* structure i (inc i) (fn [_] []))
|
(i/srange-transform* structure i (inc i) (fn [_] []))
|
||||||
(assoc structure i newv)))
|
(assoc structure i newv)))
|
||||||
|
|
@ -523,7 +523,7 @@
|
||||||
i
|
i
|
||||||
(inc i)
|
(inc i)
|
||||||
(fn [[e]]
|
(fn [[e]]
|
||||||
(let [v (next-fn e)]
|
(let [v (next-fn vals e)]
|
||||||
(if (identical? v i/NONE)
|
(if (identical? v i/NONE)
|
||||||
[]
|
[]
|
||||||
[v])
|
[v])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue