On Oct 20, 6:16 am, "Tom Emerson" <[EMAIL PROTECTED]> wrote:
> 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
If you're interested only in counting the number of unique words, then
you don't even need a map. You can get by with a set, like this:
(defn unique-words-in-file
[file]
(count (set (split-on-whitespace (slurp file)
slurp reads file into a String object in memory. The hypothetical
spli
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