You're viewing version 1.2.0 of long. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16
  • (long x)
Coerce to long

2 Examples top

  • user=> (let [num (* 1234567890 21)] [num (int num) (long num)])
    [25925925690 156121914 25925925690]
  • user=> (= 21 (long 21))
    true 
    
    ;; but
    user=> (.equals 21 (long 21))
    false 
    
    ;; and thus
    user=> (get {21 :twenty-one} (long 21))
    nil 
    
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:2669 top

(defn long
  "Coerce to long"
  {:tag Long
   :inline (fn  [x] `(. clojure.lang.RT (longCast ~x)))
   :added "1.0"}
  [^Number x] (clojure.lang.RT/longCast x))
Vars in clojure.core/long: defn
Used in 4 other vars bigdec aset-long bigint choose

Comments top

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