I 'd change the implentation of update-vals to use reduce-kv. you will
avoid the cost of destructuring on every single step :)
Jim
On 05/07/13 22:15, Jay Fields wrote:
I use update-vals from https://github.com/jaycfields/jry fairly often.
As long as you don't mind doing the pred check in the fn you pass to
update-vals, it should do the trick.
Cheers, Jay
On Fri, Jul 5, 2013 at 5:14 PM, Jim - FooBar(); <jimpil1...@gmail.com
<mailto:jimpil1...@gmail.com>> wrote:
You'll never really 'replace' any values so why not
reduce/reduce-kv ? Just build a new map out of the old one...
Jim
On 05/07/13 21:59, Colin Yates wrote:
Hi all,
I think this is one of those questions which has quite a few
answers, but given a map, how do I replace the values by
applying a function to those values, but only if they meet a
condition?
I understand the building blocks of (map..), (filter..),
(assoc-in..) and (filter..) and I can see how something could
work using those pieces but is would be pretty verbose. I am
sure there is probably a much more simple way using a more
abstract function.
The actual use case is I have a list of maps as returned from
the clojure.java.jdbc framework and they contain timestamps.
I want to replace all the timestamps with (for example) to a
Joda LocalDate using the excellent clj-time library.
Any pointers?
Thanks!
Col
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
<mailto:clojure@googlegroups.com>
Note that posts from new members are moderated - please be
patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
<mailto:clojure%2bunsubscr...@googlegroups.com>
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the
Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from
it, send an email to clojure+unsubscr...@googlegroups.com
<mailto:clojure%2bunsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/groups/opt_out.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
<mailto:clojure@googlegroups.com>
Note that posts from new members are moderated - please be patient
with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
<mailto:clojure%2bunsubscr...@googlegroups.com>
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- You received this message because you are subscribed to the
Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to clojure+unsubscr...@googlegroups.com
<mailto:clojure%2bunsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/groups/opt_out.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient
with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.