-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Description
When you need to put a vector into another vector, from start until the end of the vector to insert.
(defn replace-subvec [v v2 index]
{:pre [(vector? v)
(vector? v2)
(integer? index)]}
(let [v-count (count v)
index (if (<= index v-count)
index v-count)]
(persistent!
(reduce-kv
(fn [acc i el]
(assoc! acc (+ i index) el))
(transient v) v2))))
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels