Skip to content

clojure.core/with-meta

View this page on ClojureDocs

Type: function Added: Clojure 1.0 Examples: 4 Runnable: 1
([obj m])

Returns an object of the same type and value as obj, with map m as its metadata.

Examples

by devn on
by mmwaikar on . May have evaluation errors.
by Rovanion on . May have evaluation errors.
by jimka2001 on . May have evaluation errors.

Note by beoliver

The Clojure documentation states that "metadata does not impact equality (or hash codes). Two objects that differ only in metadata are equal." One should be aware that while a function can be compared to itself:

(defn foo [x] (+ x x))
testing equality
> (= foo foo)
true
> (= (with-meta foo {:hello :world}) foo)
false
> (= (with-meta foo {}) foo)
false

See also


Content from the matching ClojureDocs page, with authors credited on each contribution.