On Mar 23, 1:02 pm, Glen Rubin wrote:
> Does anyone know of any existing libraries for clojure that has code
> which is optimized to list all of the factors of any given integer?
(defn factors [x]
"integer -> vector[integers]"
(loop [xf [] i 2]
(if (> (* i i) x)
(vec (sort (distinct x
around since Clojure 1.0.
>
> On May 28, 3:03 pm, kotor wrote:
>
> > After updating to r1381, the following code produces a "reflection
> > warning - call to divide can't be resolved" on the last line. This
> > warning did not occur at r1376 or earlier.
>
&
After updating to r1381, the following code produces a "reflection
warning - call to divide can't be resolved" on the last line. This
warning did not occur at r1376 or earlier.
(defn prime-frequency [x y]
"integer integer -> real. frequency of primes in range"
(let [xy (range x y)]
(/ (coun
I definitely support your second option; first / rest / next. In my
mind, rest means "collection of remaining items" and should return a
collection, and next will also do exactly what I would expect it to
do. Clojure is sufficiently different from Common Lisp already that
breaking the compatibilty