Functions like conj create and return a new list, rather than modify
the original in-place. You'd need to change your doseq to something
like:
(for [old-id id-list] (choose-id old-id new-id))
I'd also use better names, perhaps
(for [old-entry entry-list] (choose-entry old-entry new-entry))
But for this sort of job you might be better off using a larger map:
{G__821 {:id G__821 :value 1} G__820 {:id G__820 :value 1} ... }
(assoc entry-map old-id new-entry)
e.g. (assoc entry-map G__821 {:id G__821 :value 10})
or even (update-in entry-map [id :value] (constantly new-value))
e.g. (update-in entry-map [G__821 :value] (constantly 10))
If you actually transform the old value with a function to get the new
one, so much the better:
(update-in entry-map [G__821 :value] #(* 10 %))
etc.
Incidentally, are all of these symbols G__xxx defined somewhere? You
might want keywords or strings instead, to avoid having to quote them
to avoid errors.
It takes a replacement-map in the form of {before after, ...} and a
collection. It replaces all befores with the corresponding afters:
=> (replace {:answer 42} [:the :answer :to :life])
[:the 42 :to :life]
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
--
Moritz Ulrich