Re: Noob question: rebinding using def

2010-02-10 Thread chaosprophet
Ah, I didn't know about the reduce function. I'll give that a try and thanks a lot. On Feb 10, 10:42 pm, Brenton wrote: > chaosprophet, > > Clojure wants you to think in terms of sequences instead to loops. > Instead to looping through cat-all and keeping track of the sum, you > want to use map a

Re: Noob question: rebinding using def

2010-02-10 Thread Brenton
chaosprophet, Clojure wants you to think in terms of sequences instead to loops. Instead to looping through cat-all and keeping track of the sum, you want to use map and reduce. (reduce + (map #(probability-of-category-given-document % tokens) cat- all)) Brenton On Feb 10, 7:14 am, chaosprophet

Noob question: rebinding using def

2010-02-10 Thread chaosprophet
Hi guys, I'm new to both clojure and functional programming and as an exercise in learning Clojure, I decided to write a naive bayes categorizer. I have a piece of code wherein I have a doseq inside which i am calling a function which returns a value. What I would like to do is have the value retur