Somehow I totally forgot I could use destructuring. Here's a slightly
shorter version:
(defn uniquify [words]
(loop [encountered {}
result []
[word & remaining] words]
(if (seq remaining)
(let [occurences (get encountered word)
modified (if occurences
(str word "_" occurences)
word)]
(recur (update-in encountered [word] (fnil inc 0))
(conj result modified)
remaining))
result)))
--
Stefan Kanev ¦ @skanev ¦ http://skanev.com/
You can measure a programmer's perspective by noting his attitude on the
continuing vitality of FORTRAN.
--
--
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.