• (inc x)
Returns a number one greater than num. Does not auto-promote
longs, will throw on overflow. See also: inc'

1 Example top

  • user=> (inc 1)
    2
    
    user=> (inc 1.0)
    2.0
    
    user=> (inc 1/2)
    3/2
    
    user=> (inc -1)
    0
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:857 top

(defn inc
  "Returns a number one greater than num. Does not auto-promote
  longs, will throw on overflow. See also: inc'"
  {:inline (fn [x] `(. clojure.lang.Numbers (~(if *unchecked-math* 'unchecked_inc 'inc) ~x)))
   :added "1.2"}
  [x] (. clojure.lang.Numbers (inc x)))
Vars in clojure.core/inc:
Used in 0 other vars

Comments top

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