Clojure - Numbers
Numbers datatype in Clojure is derived from Java classes.
Clojure supports integer and floating point numbers.
An integer is a value that does not include a fraction.
A floating-point number is a decimal value that includes a decimal fraction.
Following is an example of numbers in Clojure.
(def x 5) (def y 5.25)
Where ‘x’ is of the type Integer and ‘y’ is the float.
In Java, the following classes are attached to the numbers defined in Clojure.
To actually see that the numbers in Clojure are derived from Java classes, use the following program to see the type of numbers assigned when using the ‘def’ command.
(ns clojure.examples.hello (:gen-class)) ;; This program displays Hello World (defn Example  (def x 5) (def y 5.25) (println (type x)) (println (type y))) (Example)
The ‘type’ command is used to output the class associated with the value assigned to a variable.
The above code will produce the following output.
The following test functions are available for numbers.
|Sr.No.||Numbers & Description|
Returns true if the number is zero, else false.
Returns true if number is greater than zero, else false.
Returns true if number is less than zero, else false.
Returns true if the number is even, and throws an exception if the number is not an integer.
Returns true if the number is odd, and throws an exception if the number is not an integer.
Returns true if the number is really a Number.
Returns true if the number is an integer.
Returns true if the number is a float.