Exercise: words frequency ranking

2008-12-25 Thread Piotr 'Qertoip' WĹ‚odarek
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

Re: Exercise: words frequency ranking

2008-12-25 Thread Mibu
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)) }) {}

Re: Exercise: words frequency ranking

2008-12-25 Thread Meikel Brandmeyer
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

Re: Proxying in clojure

2008-12-25 Thread Emeka
Snake frame would appear with square ball that moves and another that does not move.Below is what I got each time I try to play with arrow keys. I count on you as always to come to my help. user= (require 'snake) nil user= (snake/run-snake)nil user= Exception in thread AWT-EventQueue-0

Re: Proxying in clojure

2008-12-25 Thread Chouser
On Thu, Dec 25, 2008 at 5:52 PM, Emeka emekami...@gmail.com wrote: Exception in thread AWT-EventQueue-0 java.lang.UnsupportedOperationException: keyReleased It was to avoid this exception that my version included an empty implementation of keyReleased. --Chouser