• (+)
  • (+ x)
  • (+ x y)
  • (+ x y & more)
Returns the sum of nums. (+) returns 0. Does not auto-promote
longs, will throw on overflow. See also: +'

1 Example top

  • user=> (+)
    0
    
    user=> (+ 1)
    1
    
    user=> (+ -10)
    -10
    
    user=> (+ 1 2)
    3
    
    user=> (+ 1 2 3)
    6
    
    user=> (apply + (range 10))
    45
Log in to add / edit an example.

See Also top

  • 1
    clojure.core/+'

    Returns the sum of nums. (+) returns 0. Supports arbitrary precision.

  • 0
    clojure.core/-

    If no ys are supplied, returns the negation of x, else subtracts th

  • 0
    clojure.core/*

    Returns the product of nums. (*) returns 1.

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:919 top

(defn +
  "Returns the sum of nums. (+) returns 0. Does not auto-promote
  longs, will throw on overflow. See also: +'"
  {:inline (nary-inline 'add 'unchecked_add)
   :inline-arities >1?
   :added "1.2"}
  ([] 0)
  ([x] (cast Number x))
  ([x y] (. clojure.lang.Numbers (add x y)))
  ([x y & more]
     (reduce1 + (+ x y) more)))
Vars in clojure.core/+:
Used in 0 other vars

Comments top

No comments for +. Log in to add a comment.