What are the differences between type
and class
in Clojure?
(type "") => java.lang.String
(class "") => java.lang.String
(type 1) => java.lang.Long
(class 1) => java.lang.Long
According to ClojureDocs
type
clojure.core
(type x)
Returns the :type
metadata of x
, or its Class
if none
class
clojure.core
(class x)
Returns the Class
of x
So, basically if there're metadata inside x
, type
should return its :type
metadata, otherwise they're the same thing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With