Venlig hilsen and Timothy Prately
Thanks so much.
Emeka
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group,
Hehe, venlig hilsen is danish for kind regards :)
On Sat, Jan 3, 2009 at 3:23 PM, Emeka emekami...@gmail.com wrote:
Venlig hilsen and Timothy Prately
Thanks so much.
Emeka
--
Venlig hilsen / Kind regards,
Christian Vest Hansen.
--~--~-~--~~~---~--~~
Thanks. I have learnt some new.
Emeka
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to
You could consider using a StreamTokenizer:
(import '(java.io StreamTokenizer BufferedReader FileReader))
(defn wordfreq [filename]
(with-local-vars [words {}]
(let [st (StreamTokenizer. (BufferedReader. (FileReader.
filename)))]
(loop [tt (.nextToken st)]
(when (not= tt
Hello sir,
I would have asked this question in the thread but , I don't want to create
noise over this issue.
I have not been able to get my head around your code or Clojure. I need some
support.
(defn top-words-core [s]
(reduce #(assoc %1 %2 (inc (%1 %2 0))) {}
(re-seq #\w+
(defn top-words-core [s]
(reduce #(assoc %1 %2 (inc (%1 %2 0))) {}
(re-seq #\w+
(.toLowerCase s
maps are functions of their keys means:
user= ({:a 1, :b 2, :c 3} :a)
1
Here we created a map {:a 1, :b 2, :c 3}, can then called it like a
function with
Hello. I can't seem to find 'spit'.
java exception: unable to resolve symbol spit.
I'm using Clojure Box rev1142. Tried using the clojure.jar from the
20081217 release
of Clojure but to no avail.
spit is not documented on the clojure site API page like slurp is. I
can't
find it in clojure
You're not at fault here. The documentation about loading libraries is
still scarce and not very helpful yet. I too had to scramble to figure
this one out.
spit is in the duck-streams library in clojure.contrib. I understand
it is planned to be moved to the core library, as it should.
Here is
On Dec 28, 9:33 am, Mibu mibu.cloj...@gmail.com wrote:
You're not at fault here. The documentation about loading libraries is
still scarce and not very helpful yet. I too had to scramble to figure
this one out.
spit is in the duck-streams library in clojure.contrib. I understand
it is
On Sun, Dec 28, 2008 at 9:22 AM, Boyd Brown boy...@gmail.com wrote:
Hello. I can't seem to find 'spit'.
'spit' is in clojure-contrib:
http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/duck_streams.clj?r=325#177
It's inclusion in clojure.core is planned (search
Thank you for all improvements and suggestions. Based on your
feedback, here is my final version:
(defn read-words
Given a file, return a seq of every word in the file, normalizing
words by
coverting them to lower case and splitting on whitespace
[in-filepath]
(re-seq #\w+
And the nice pastie version: http://pastie.org/347369
regards,
Piotrek
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe
Instead of #(- (val %)), one could also use the compose function :
(comp - val)
My 0,02 EURO,
--
Laurent
On Dec 25, 4:58 pm, Mibu mibu.cloj...@gmail.com wrote:
My version:
(defn top-words [input-filename result-filename]
(spit result-filename
(apply str
(map
What would you think of this form of coding ?
- The rationale is to separate functions that deal with system
boundaries from core algorithmic functions.
So you should at least have two functions : one that does not deal
with input/output formats : will only deal with clojure/java
constructs.
-
On Dec 25, 4:58 pm, Mibu mibu.cloj...@gmail.com wrote:
My version:
(defn top-words [input-filename result-filename]
(spit result-filename
(apply str
(map #(format %s : %d\n (first %) (second %))
(sort-by #(-(val %))
Given the input text file, the program should write to disk a ranking
of words sorted by frequency, like:
the : 52483
and : 32558
of : 23477
a : 22486
to : 21993
My first implementation:
(defn topwords
My version:
(defn top-words [input-filename result-filename]
(spit result-filename
(apply str
(map #(format %s : %d\n (first %) (second %))
(sort-by #(-(val %))
(reduce #(conj %1 { %2 (inc (%1 %2 0)) }) {}
Hi,
Am 25.12.2008 um 17:24 schrieb wwmorgan:
A better implementation would split the different steps of the program
into separate functions. This increases readability and testability of
the source code, and encourages the reuse of code in new programs.
Yes. One can think of the data flowing
18 matches
Mail list logo