0
Fork 0
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:
Andrey Antukh 2021-03-15 08:38:01 +01:00
parent 84b7a2de0b
commit f7d0383919

View file

@ -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]