Skip to content

Instantly share code, notes, and snippets.

@loganlinn
Created July 31, 2014 19:23
Show Gist options
  • Save loganlinn/1d3296706106a96b8ca8 to your computer and use it in GitHub Desktop.
Save loganlinn/1d3296706106a96b8ca8 to your computer and use it in GitHub Desktop.
(defn mapv-indexed
[f coll]
(let [v (transient [])]
(loop [idx 0
coll (seq coll)]
(when coll
(conj! v (f idx (first coll)))
(recur (inc idx) (next coll))))
(persistent! v)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment