diff options
author | scgilardi <scgilardi@gmail.com> | 2009-03-01 15:20:01 +0000 |
---|---|---|
committer | scgilardi <scgilardi@gmail.com> | 2009-03-01 15:20:01 +0000 |
commit | d404530419fdb1f5b86cf7587305533d50bf8b5a (patch) | |
tree | 280792c9bcd9b0e2aa30b403e43793c157c7ea97 | |
parent | 75b13a2a10df0209c75629750077a5bd3e88fbb5 (diff) |
interim: rename clojure.contrib.macros.letfn to letfn-kh because clojure.core now defines letfn. Making this change to allow clojure.contrib to compile/run until Konrad makes his preferred fix
-rw-r--r-- | src/clojure/contrib/accumulators.clj | 4 | ||||
-rw-r--r-- | src/clojure/contrib/macros.clj | 4 | ||||
-rw-r--r-- | src/clojure/contrib/monads/test.clj | 2 | ||||
-rw-r--r-- | src/clojure/contrib/probabilities/dist.clj | 6 | ||||
-rw-r--r-- | src/clojure/contrib/stream_utils.clj | 6 |
5 files changed, 11 insertions, 11 deletions
diff --git a/src/clojure/contrib/accumulators.clj b/src/clojure/contrib/accumulators.clj index bbbcd64f..48b00b2a 100644 --- a/src/clojure/contrib/accumulators.clj +++ b/src/clojure/contrib/accumulators.clj @@ -20,7 +20,7 @@ (ns clojure.contrib.accumulators (:use [clojure.contrib.types :only (deftype get-value get-values)]) - (:use [clojure.contrib.macros :only (letfn)]) + (:use [clojure.contrib.macros :only (letfn-kh)]) (:use [clojure.contrib.def :only (defvar defvar- defmacro-)])) (defmulti add @@ -222,7 +222,7 @@ (defmethod combine type-tag [v & vs] - (letfn [add-item [counter [item n]] + (letfn-kh [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))) diff --git a/src/clojure/contrib/macros.clj b/src/clojure/contrib/macros.clj index e58892c4..cf4bc1eb 100644 --- a/src/clojure/contrib/macros.clj +++ b/src/clojure/contrib/macros.clj @@ -18,9 +18,9 @@ (eval expr)) ;; By Konrad Hinsen -(defmacro letfn +(defmacro letfn-kh "A variant of let for local function definitions. fn-bindings consists - of name/args/body triples, with (letfn [name args body] ...) + of name/args/body triples, with (letfn-kh [name args body] ...) being equivalent to (let [name (fn name args body)] ...)." [fn-bindings & exprs] (let [makefn (fn [[name args body]] (list name (list 'fn name args body))) diff --git a/src/clojure/contrib/monads/test.clj b/src/clojure/contrib/monads/test.clj index 8731b940..9fbe3928 100644 --- a/src/clojure/contrib/monads/test.clj +++ b/src/clojure/contrib/monads/test.clj @@ -48,7 +48,7 @@ (deftest seq-maybe-monad (with-monad (maybe-t sequence-m) - (letfn [pairs [xs] ((m-lift 2 #(list %1 %2)) xs xs)] + (letfn-kh [pairs [xs] ((m-lift 2 #(list %1 %2)) xs xs)] (are (= _1 _2) ((m-lift 1 inc) (for [n (range 10)] (when (odd? n) n))) '(nil 2 nil 4 nil 6 nil 8 nil 10) 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))))] diff --git a/src/clojure/contrib/stream_utils.clj b/src/clojure/contrib/stream_utils.clj index 605426db..3ba04e69 100644 --- a/src/clojure/contrib/stream_utils.clj +++ b/src/clojure/contrib/stream_utils.clj @@ -53,7 +53,7 @@ in the form of a vector." (:use [clojure.contrib.monads]) - (:use [clojure.contrib.macros :only (letfn)])) + (:use [clojure.contrib.macros :only (letfn-kh)])) (let [eos (Object.) @@ -150,7 +150,7 @@ stream-m monad) and a vector of stream arguments and returns a stream generator function representing the output stream of the transformer." [st streams] - (letfn [make-gen [s] + (letfn-kh [make-gen [s] (fn [eos] (loop [s s] (let [[v ns] (st s)] @@ -207,7 +207,7 @@ sequences. Flattening is not recursive, only one level of sequences will be removed." [s] - (letfn [buffer-gen [buffer stream] + (letfn-kh [buffer-gen [buffer stream] (fn [eos] (loop [buffer buffer stream stream] |