On my machine that's 17 seconds.
With a couple minor changes, it can run in 3.4 seconds:
(time
(loop [acc (double 0) ind 0]
(if (< ind 100000000)
(recur (+ acc (. java.lang.Math (sqrt ind))) (inc ind))
acc)))
--Chouser
I think that would be a nice convenience. I see that BigDecimal
already uses the M suffix on read and prn.
The precedent in other languages seems to be to make the suffixes case
insensitive.
Should there be a suffix for BigInt? (My current thought is that it's
not necessary.)
While looking at this, I noticed this which surprised me:
user=> (bigdec 1)
java.lang.IllegalArgumentException: No matching method found: valueOf
--Steve
if not, please make it required as upper case to avoid the "1" vs. "l" problems.
Accept upper or lower, sure, but why forbid the lower-case, even
for 'l'? Most programmers use fonts that clearly distinguish O / and
1 / l and there's no reason they should be forced to use the upper-case
if they don't want to.
Randall Schulz