I want to calculate !1000 in clojure, how can I do this without getting a integer-overflow exception?
!1000
My factorial code is right now: (reduce * (range 1 1001)).
(reduce * (range 1 1001))
You could use the *' operator which supports arbitrary precision by automatically promoting the result to BigInt in case it would overflow:
*'
(reduce *' (range 1 1001))
1.4m articles
1.4m replys
5 comments
57.0k users