diff options
author | Rich Hickey <richhickey@gmail.com> | 2010-06-18 22:42:11 -0400 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2010-06-18 22:42:11 -0400 |
commit | b71e3d733b8c590eb3b0b9e8d555de4f1311a9ad (patch) | |
tree | d86bd7b07ad1aa99e90f806ec6e63da7456adb68 | |
parent | d971ab4977e6c5a3cd565c2f68bfffa33439a961 (diff) |
make loop/recur match for num compat
-rw-r--r-- | src/main/clojure/clojure/contrib/math.clj | 2 | ||||
-rw-r--r-- | src/main/clojure/clojure/contrib/pprint/cl_format.clj | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/main/clojure/clojure/contrib/math.clj b/src/main/clojure/clojure/contrib/math.clj index cef32bf2..56007c71 100644 --- a/src/main/clojure/clojure/contrib/math.clj +++ b/src/main/clojure/clojure/contrib/math.clj @@ -104,7 +104,7 @@ Returns an exact number if the base is an exact number and the power is an integ expt (fn [x y] [(class x) (class y)]))
(defn- expt-int [base pow]
- (loop [n pow, y 1, z base]
+ (loop [n pow, y (num 1), z base]
(let [t (bit-and n 1), n (bit-shift-right n 1)]
(cond
(zero? t) (recur n y (* z z))
diff --git a/src/main/clojure/clojure/contrib/pprint/cl_format.clj b/src/main/clojure/clojure/contrib/pprint/cl_format.clj index f6e988ca..a7aeca30 100644 --- a/src/main/clojure/clojure/contrib/pprint/cl_format.clj +++ b/src/main/clojure/clojure/contrib/pprint/cl_format.clj @@ -834,7 +834,7 @@ Note this should only be used for the last one in the sequence" args (init-navigator arg-list)] (loop [count 0 args args - last-pos -1] + last-pos (num -1)] (if (and (not max-count) (= (:pos args) last-pos) (> count 1)) ;; TODO get the offset in here and call format exception (throw (RuntimeException. "%{ construct not consuming any arguments: Infinite loop!"))) @@ -880,7 +880,7 @@ Note this should only be used for the last one in the sequence" [param-clause navigator])] (loop [count 0 navigator navigator - last-pos -1] + last-pos (num -1)] (if (and (not max-count) (= (:pos navigator) last-pos) (> count 1)) ;; TODO get the offset in here and call format exception (throw (RuntimeException. "%@{ construct not consuming any arguments: Infinite loop!"))) |