Thank you all for your help, I appreciate it very much. I come from
the world of OO programming and I am bending my head backwards to try
to think in the functional paradigm.
Bellow you will find my version of Peter Norvig's spell checker
(http://norvig.com/spell-correct.html) in clojure,
Bellow you will find my version of Peter Norvig's spell checker
(http://norvig.com/spell-correct.html) in clojure, followed by the
java version. I coded the later first and then I attempted to
translate it. In a few months time I will try to implement it again
from scratch (in clojure) and I
Hi,
I am trying to store into a map the frequency of each [a-z]+ word in a
file. When I run this code in the repl the resulting dictionary is
empty. How should I adapt my code to get this functionality right?.
Thank you in advance
(import (java.io BufferedReader FileReader))
(def dictionary
You're not capturing the output of the reduce anywhere; doseq is for
side-effects only.
If you wrapped the doseq in a (def dictionary ...) it would work,
but this is not recommended.
Instead, you should either use nested reductions, or produce a simple
list of tokens first (simpler):
(defn
I was typing up an answer, but Jason answered faster and better :)
The only thing I have to add is that 'frequencies' is also in clojure
core as of 1.2.
On Jan 6, 1:13 pm, Jason Wolfe ja...@w01fe.com wrote:
You're not capturing the output of the reduce anywhere; doseq is for
side-effects only.
On Thu, Jan 6, 2011 at 1:49 PM, new2clojure miguel.arre...@gmail.com wrote:
Hi,
I am trying to store into a map the frequency of each [a-z]+ word in a
file. When I run this code in the repl the resulting dictionary is
empty. How should I adapt my code to get this functionality right?.
On Thu, Jan 6, 2011 at 10:49 AM, new2clojure miguel.arre...@gmail.com wrote:
I am trying to store into a map the frequency of each [a-z]+ word in a
file. When I run this code in the repl the resulting dictionary is
empty. How should I adapt my code to get this functionality right?.
Other