with-meta

clojure.core

  • (with-meta obj m)
Returns an object of the same type and value as obj, with
map m as its metadata.

2 Examples top

  • user=> (with-meta [1 2 3] {:my "meta"})
    [1 2 3]
    
    user=> (meta (with-meta [1 2 3] {:my "meta"}))
    {:my "meta"}
    
  • ;; the same example above in a simplified way
    user=> (def wm (with-meta [1 2 3] {:my "meta"}))
    #'user/wm
    
    user=> wm
    [1 2 3]
    
    user=> (meta wm)
    {:my "meta"}
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:204 top

(def
 ^{:arglists '([^clojure.lang.IObj obj m])
   :doc "Returns an object of the same type and value as obj, with
    map m as its metadata."
   :added "1.0"
   :static true}
 with-meta (fn ^:static with-meta [^clojure.lang.IObj x m]
             (. x (withMeta m))))
Vars in clojure.core/with-meta:
Used in 0 other vars

Comments top

No comments for with-meta. Log in to add a comment.