Mercurial > cortex
diff org/util.org @ 151:aaacf087504c
refactored vision code
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 03 Feb 2012 05:52:18 -0700 |
parents | b591da250afc |
children | c95179907951 |
line wrap: on
line diff
1.1 --- a/org/util.org Fri Feb 03 05:08:45 2012 -0700 1.2 +++ b/org/util.org Fri Feb 03 05:52:18 2012 -0700 1.3 @@ -197,6 +197,13 @@ 1.4 [fn m] 1.5 (apply fn (reduce #(into %1 %2) [] m))) 1.6 1.7 +(defn map-vals 1.8 + "Transform a map by applying a function to its values, 1.9 + keeping the keys the same." 1.10 + [f m] (zipmap (keys m) (map f (vals m)))) 1.11 + 1.12 + 1.13 + 1.14 #+end_src 1.15 1.16 #+results: util