Skip to content

Commit 5ade6ce

Browse files
committed
Fix for version 1.2 support
1 parent 500a7a3 commit 5ade6ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/clojure/clojure/math/combinatorics.clj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ In prior versions of the combinatorics library, there were two similar functions
308308

309309
(defn- factorial [n]
310310
{:pre [(integer? n) (not (neg? n))]}
311-
; (Long/valueOf 1) eliminates loop auto-boxing warning, in a way compatible with Clojure 1.2
312-
(loop [acc (Long/valueOf 1), n n]
311+
; (Long/valueOf (long 1)) eliminates loop auto-boxing warning, in a way compatible with Clojure 1.2
312+
(loop [acc (Long/valueOf (long 1)), n n]
313313
(if (zero? n) acc (recur (mult acc n) (dec n)))))
314314

315315
(defn- factorial-numbers
@@ -513,7 +513,7 @@ so that we can memoize over a series of calls."
513513
(count-combinations-unmemoized items t)))
514514

515515
(defn- expt-int [base pow]
516-
(loop [n pow, y (Long/valueOf 1), z base]
516+
(loop [n pow, y (Long/valueOf (long 1)), z base]
517517
(let [t (even? n), n (quot n 2)]
518518
(cond
519519
t (recur n y (mult z z))
@@ -609,15 +609,15 @@ represented by freqs"
609609

610610
(defn- permutation-index-distinct
611611
[l]
612-
(loop [l l, index (Long/valueOf 0), n (dec (count l))]
612+
(loop [l l, index (Long/valueOf (long 0)), n (dec (count l))]
613613
(if (empty? l) index
614614
(recur (rest l)
615615
(+ index (* (factorial n) (list-index (sort l) (first l))))
616616
(dec n)))))
617617

618618
(defn- permutation-index-duplicates
619619
[l]
620-
(loop [l l, index (Long/valueOf 0), freqs (into (sorted-map) (frequencies l))]
620+
(loop [l l, index (Long/valueOf (long 0)), freqs (into (sorted-map) (frequencies l))]
621621
(if (empty? l) index
622622
(recur (rest l)
623623
(reduce + index

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy