Clojure - Metadata


In Clojure, metadata is used to annotate the data in a collection or for the data stored in a symbol. This is normally used to annotate data about types to the underlying compiler, but can also be used for developers. Metadata is not considered as part of the value of the object. At the same time, metadata is immutable.

The following operations are possible in Clojure with regards to metadata.

Sr.No. Operations & Description
1 meta-with

This function is used to define a metadata map for any object.

2 meta

This function is used to see if any metadata is associated with an object.

3 vary-meta

Returns an object of the same type and value as the original object, but with a combined metadata.