mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 23:49:45 -05:00
⚡ Improve performance of enumerate data helper.
This commit is contained in:
parent
84b7a2de0b
commit
f7d0383919
1 changed files with 4 additions and 5 deletions
|
@ -42,7 +42,6 @@
|
|||
([a b & rest]
|
||||
(reduce deep-merge a (cons b rest))))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Data Structures Manipulation
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -70,14 +69,14 @@
|
|||
(defn enumerate
|
||||
([items] (enumerate items 0))
|
||||
([items start]
|
||||
(loop [idx start
|
||||
(loop [idx start
|
||||
items items
|
||||
res []]
|
||||
res (transient [])]
|
||||
(if (empty? items)
|
||||
res
|
||||
(persistent! res)
|
||||
(recur (inc idx)
|
||||
(rest items)
|
||||
(conj res [idx (first items)]))))))
|
||||
(conj! res [idx (first items)]))))))
|
||||
|
||||
(defn seek
|
||||
([pred coll]
|
||||
|
|
Loading…
Add table
Reference in a new issue