You're viewing version 1.2.0 of rational?. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16



  • (rational? n)

1 Example top

  • user=> (rational? 1)
    user=> (rational? 1.0)
    user=> (class 1.0)
    ;; Note that decimal? only returns true if n is a BigDecimal.
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:2774 top

(defn rational? [n]
  "Returns true if n is a rational number"
  {:added "1.0"}
  (or (integer? n) (ratio? n) (decimal? n)))
Vars in clojure.core/rational?: decimal? defn integer? or ratio?
Used in 0 other vars

Comments top

No comments for rational?. Log in to add a comment.