Here's the code analogue of your find-assoc-in function for the approach
Cedric is proposing. I actually came to the same solution before reading
the responses to your post, so it's good to see that others also think this
is a more memory efficient approach (obviously for larger vectors than the
example).
(defn my-find-assoc-in
[[test-key update-key] [test-val update-val] mapvec]
(reduce
(fn [v idx] (if (= (get-in v [idx test-key]) test-val)
(assoc-in v [idx update-key] update-val)
v))
mapvec
(range (count mapvec))))
Happy hacking,
~Gary
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.