If you want to reduce the map, there's nothing to be gained from the
map being transient -- just use reduce-kv (or reduce pre-1.4) on the
persistent map.

If you want to map over the entries, again, there's nothing to be
gained from the map being transient. (But if you want to pour the
transformed entries into a map, (into {} ...) will use a transient map
to speed up the process.)

If you want to do something like replacing all values in the
transient, you could take the key set of the persistent map and only
then create the transient and modify it while looping over the keys:

(let [m { ... }]
  (reduce (fn [out k] (let [v (m k)] ...))
          (transient m)
          (.keySet m)))

(Or use loop/recur to do the same.)

Note that if you already hold a transient at the point where you want
to perform this operation, you'll need to use persistent! first and
then make a new transient. You'll also need to use persistent! for
reductions and mapping over the entry seq, since transients don't
support operations of this sort.

Cheers,
Michał


On 16 May 2012 16:20, nicolas.o...@gmail.com <nicolas.o...@gmail.com> wrote:
> Dear all,
>
> Is there a way to apply a function to all members of a transient map?
>
>
> Best regards,
>
> Nicolas.
>
> --
> 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 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

Reply via email to