Skip to content

Instantly share code, notes, and snippets.

@fffej
Created August 4, 2009 07:29
Show Gist options
  • Save fffej/161081 to your computer and use it in GitHub Desktop.
Save fffej/161081 to your computer and use it in GitHub Desktop.
(defn vector-map-transient
"A version of map that only works on vectors"
[f v]
(loop [i 0 out (transient []) n (count v)]
(if (<= n i)
(persistent! out)
(recur (inc i) (conj! out (f (v i))) n))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment