# vary-meta
Apply `$f` to the value's current metadata (or nil when it has none) and attach
the result — equivalent to `[with-meta $value [$f [meta $value]]]`. Convenient
for threading functional metadata updates.
## Syntax
[vary-meta $value $f]
## Parameters
- `$value` — A metadata-capable value: map, tagged map, vector, set, string, or
keyword.
- `$f` — Callable receiving the current metadata map (or nil) and returning the
new metadata map, or nil to strip it.
## Examples
def v [with-meta :deepseek %{n 1}] [meta [vary-meta $v {|m| [assoc $m :n ($m~n + 1)]}]] # → %{:n 2} [meta [vary-meta :plain {|m| %{seen true}}]] # → %{seen true}
## Returns
A new value sharing the payload, with `$f`'s result attached as metadata (a nil
result strips it). `%Err{:message "vary-meta: second argument must be callable"}`
when `$f` is not callable; immediate values (numbers, nil, booleans) return
unchanged.
## See Also
`with-meta`, `meta`, `without-meta`