Re: newbie: simple histogram problem

2010-06-14 Thread Steve Purcell
On 14 Jun 2010, at 12:37, Steve Purcell wrote: > On 14 Jun 2010, at 01:14, Todd wrote: > >> I'm attempting to write a simple histogram function: >> >> >> (defn create-histogram [f] >> (let >> [words (read-lines f) >>histo {}] >> (doall >> (map >> (fn [w] (assoc histo w (+1 (ge

Re: newbie: simple histogram problem

2010-06-14 Thread Steve Purcell
On 14 Jun 2010, at 01:14, Todd wrote: > I'm attempting to write a simple histogram function: > > > (defn create-histogram [f] > (let >[words (read-lines f) > histo {}] >(doall > (map >(fn [w] (assoc histo w (+1 (get histo w 0 >words)) >histo)) > > (crea

newbie: simple histogram problem

2010-06-14 Thread Todd
I'm attempting to write a simple histogram function: (defn create-histogram [f] (let [words (read-lines f) histo {}] (doall (map (fn [w] (assoc histo w (+1 (get histo w 0 words)) histo)) (create-histogram "./testwords") The input, 'f', is expected