Clojure – meta

Clojure meta

In this guide, we will discuss Clojure meta. This function is used to see if any metadata is associated with an object.

Syntax

Following is the syntax.

(meta obj)

Parameters − ‘obj’ is the object which needs to be checked if any metadata is associated with it.

Return Value − Returns the metadata of obj, returns nil if there is no metadata.

Example

An example on how this is used is shown in the following program.

(ns clojure.examples.example
   (:gen-class))
(defn Example []
   (def my-map (with-meta [1 2 3] {:prop "values"}))
   (println (meta my-map)))
(Example)

Output

The above program produces the following output.

{:prop values}

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply