Colin Yates <[email protected]> writes:
> This and Jonas' are my current favourites, for what that's worth.
>
> Keep the suggestions coming!
here's another one that uses reductions. formatter would need to be
adapted a bit, since it currently also adds "_0" for the first name
seen:
(defn count-name
[name->count name]
(assoc name->count name (inc (get name->count name 0))))
(defn uniquify
([s] (uniquify s (fn [item duplicates] (str item "_" duplicates))))
([s formatter]
(map (fn [name name->count]
(formatter name (get name->count name 0)))
s
(reductions count-name {} s))))
--
--
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.