Created
August 4, 2009 07:29
-
-
Save fffej/161081 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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