rational?

added
1.0

ns
clojure.core

type
function

(rational? n)

Returns true if n is a rational number

                user=> (rational? 1)
true
user=> (rational? 1.0)
false
user=> (class 1.0)
java.lang.Double

;; Note that decimal? only returns true if n is a BigDecimal.
            
                ;; Both True
user=> (ratio? 22/7) 
;; => true
user=> (rational? 22/7)
;; => true

;; Different
user=> (ratio? 22)
;; => false
user=> (rational? 22)
;; => true

;; Both False
user=> (ratio? 0.5)
;; => false
user=> (rational? 0.5)
;; => false