Hi all,
I have a somewhat embarassing newbie question on the use of hash maps
in a functional environment.
Consider a little utility that counts the number of unique words in a
file. A hash map mapping strings to integers is the obvious data
structure for this, but the fact that (assoc) returns a new map each
time it is called is tripping me up: since I can't define a 'global'
hash map to accumulate the counts, do you pass one around in a
function? or do you structure the code a different way? This is a
difference from what I would do in Common Lisp, where I would just
have a global that is used for the collection.
Thanks in advance for your wisdom.
-tree
--
Tom Emerson
[EMAIL PROTECTED]
http://www.dreamersrealm.net/~tree
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---