ClojureDocs

Nav

Namespaces

+'

clojure.core

Available since 1.0 (source)
  • (+')
  • (+' x)
  • (+' x y)
  • (+' x y & more)
Returns the sum of nums. (+') returns 0. Supports arbitrary precision.
See also: +
2 Examples
(+')
;;=> 0

(+' 1)
;;=> 1

(+' -10)
;;=> -10

(+' 1 2)
;;=> 3

(+' 1 2 3)
;;=> 6

(apply + (range 10000000000000 10000000001000))
;; ArithmeticException: integer overflow

(apply +' (range 10000000000000 10000000001000))
;;=> 1000000000499500
(class 1)
;; => java.lang.Long

(+ 1 Long/MAX_VALUE)
;; => java.lang.ArithmeticException: integer overflow
;;        Numbers.java:1388 clojure.lang.Numbers.throwIntOverflow
;;        Numbers.java:1687 clojure.lang.Numbers.add

(+' 1 Long/MAX_VALUE)
;; => 9223372036854775808N

(class (+' 1 Long/MAX_VALUE))
;; => clojure.lang.BigInt
See Also

Returns the sum of nums. (+) returns 0. Does not auto-promote longs, will throw on overflow. See a...

Added by phreed

Returns the sum of x and y, both long. Note - uses a primitive operator subject to overflow.

Added by Dimagog
0 Notes
No notes for +'