diff options
Diffstat (limited to 'src/clojure/contrib/probabilities')
-rw-r--r-- | src/clojure/contrib/probabilities/dist.clj | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/clojure/contrib/probabilities/dist.clj b/src/clojure/contrib/probabilities/dist.clj index 4c1d321f..a5a07c80 100644 --- a/src/clojure/contrib/probabilities/dist.clj +++ b/src/clojure/contrib/probabilities/dist.clj @@ -26,7 +26,7 @@ [m-result (fn m-result-dist [v] {v 1}) m-bind (fn m-bind-dist [mv f] - (letfn [add-prob [dist [x p]] + (letfn-kh [add-prob [dist [x p]] (assoc dist x (+ (get dist x 0) p))] (reduce add-prob {} (for [[x p] mv [y q] (f x)] @@ -91,7 +91,7 @@ pairs. In the last pair, the probability can be given by the keyword :else, which stands for 1 minus the total of the other probabilities." [& choices] - (letfn [add-choice [dist [p v]] + (letfn-kh [add-choice [dist [p v]] (cond (nil? p) dist (= p :else) (let [total-p (reduce + (vals dist))] @@ -132,7 +132,7 @@ (with-monad dist-m (defn- select-n [n xs] - (letfn [select-1 [[s xs]] + (letfn-kh [select-1 [[s xs]] (uniform (for [i (range (count xs))] (let [[nth rest] (nth-and-rest i xs)] (list (cons nth s) rest))))] |