In the JVM, two equal integers between -128 and 127 always the same because it supports IntegerCache .
This means that two equal integers from -128 to 127 are always the same instance of the Integer class.
Try comparing different integers:
(identical? 4 (+ 2 2)) ; true (identical? 127 127) ; true (identical? 128 128) ; false
See this answer on Code Golf for more information.
source share