diff options
author | Konrad Hinsen <konrad.hinsen@laposte.net> | 2009-03-02 11:35:07 +0000 |
---|---|---|
committer | Konrad Hinsen <konrad.hinsen@laposte.net> | 2009-03-02 11:35:07 +0000 |
commit | adef4d0980992077b804796f80cceb7b5f9ee780 (patch) | |
tree | cdd11986ae3ca4174efd43f869e847cba2d7f2bf /src/clojure/contrib/accumulators.clj | |
parent | e349bec891f980cad20e0fa734045a6bd57820e2 (diff) |
General revision of my modules:
- Replaced clojure.contrib.macros/letfn by clojure.core/letfn
- Introduced namespaces for all tests and examples
- Fixed namespace-related bugs in monads and stream-utils
- Introduced :only clause into all :use clauses
Diffstat (limited to 'src/clojure/contrib/accumulators.clj')
-rw-r--r-- | src/clojure/contrib/accumulators.clj | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/clojure/contrib/accumulators.clj b/src/clojure/contrib/accumulators.clj index 48b00b2a..f06badf7 100644 --- a/src/clojure/contrib/accumulators.clj +++ b/src/clojure/contrib/accumulators.clj @@ -1,7 +1,7 @@ ;; Accumulators ;; by Konrad Hinsen -;; last updated February 27, 2009 +;; last updated March 2, 2009 ;; This module defines various accumulators (list, vector, map, ;; sum, product, counter, and combinations thereof) with a common @@ -20,7 +20,6 @@ (ns clojure.contrib.accumulators (:use [clojure.contrib.types :only (deftype get-value get-values)]) - (:use [clojure.contrib.macros :only (letfn-kh)]) (:use [clojure.contrib.def :only (defvar defvar- defmacro-)])) (defmulti add @@ -222,9 +221,9 @@ (defmethod combine type-tag [v & vs] - (letfn-kh [add-item [counter [item n]] - (assoc counter item (+ n (get counter item 0))) - add-two [c1 c2] (reduce add-item c1 c2)] + (letfn [(add-item [counter [item n]] + (assoc counter item (+ n (get counter item 0)))) + (add-two [c1 c2] (reduce add-item c1 c2))] (reduce add-two v vs))) (defmethod add type-tag |