function | since v0.0-927 | clojure.core/vary-meta | Edit |
(vary-meta obj f)
(vary-meta obj f a)
(vary-meta obj f a b)
(vary-meta obj f a b c)
(vary-meta obj f a b c d)
(vary-meta obj f a b c d & args)
Returns an object of the same type and value as obj
, with
(apply f (meta obj) args)
as its metadata.
(def a ^:foo [1 2 3])
(def b (vary-meta a assoc :bar true))
(= a b)
;;=> true
(meta a)
;;=> {:foo true}
(meta b)
;;=> {:foo true, :bar true}
Returns an object of the same type and value as obj, with (apply f (meta obj) args) as its metadata.
(defn vary-meta
([obj f]
(with-meta obj (f (meta obj))))
([obj f a]
(with-meta obj (f (meta obj) a)))
([obj f a b]
(with-meta obj (f (meta obj) a b)))
([obj f a b c]
(with-meta obj (f (meta obj) a b c)))
([obj f a b c d]
(with-meta obj (f (meta obj) a b c d)))
([obj f a b c d & args]
(with-meta obj (apply f (meta obj) a b c d args))))