Skip to content

Commit

Permalink
make loop/recur match for num compat
Browse files Browse the repository at this point in the history
  • Loading branch information
richhickey committed Jun 19, 2010
1 parent d971ab4 commit b71e3d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/clojure/clojure/contrib/math.clj
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions src/main/clojure/clojure/contrib/pprint/cl_format.clj
Expand Up @@ -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!")))
Expand Down Expand Up @@ -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!")))
Expand Down

0 comments on commit b71e3d7

Please sign in to comment.