ClojureDocs

导航

命名空间

vary-meta

clojure.core

1.0 版起支持 (来源)
  • (vary-meta obj f & args)
Returns an object of the same type and value as obj, with
(apply f (meta obj) args) as its metadata.
2 Examples
user=> (meta (vary-meta 'foo assoc :a 1))
{:a 1}
;; continuing from the previous with-meta example
user=> (def wm (with-meta [1 2 3] {:my "meta"}))
#'user/wm

user=> wm
[1 2 3]

user=> (meta wm)
{:my "meta"}

user=> (def new-wm (vary-meta wm assoc :your "new meta"))
#'user/new-wm

user=> new-wm
[1 2 3]

user=> (meta new-wm)
{:my "meta", :your "new meta"}

See Also

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

Added by ninjudd

Atomically sets the metadata for a namespace/var/ref/agent/atom to be: (apply f its-current-meta ...

Added by alilee
0 Notes
No notes for vary-meta