Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pixie/stdlib.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -2717,3 +2717,11 @@ Calling this function on something that is not ISeqable returns a seq with that
(if (satisfies? IComparable x)
(-compare x y)
(throw [::ComparisonError (str x " does not satisfy IComparable")])))

(defn vary-meta
{:doc "Returns x with meta data updated with the application of f and args to it.
ex: (vary-meta x assoc :foo 42)"
:signatures [[x f & args]]
:added "0.1"}
[x f & args]
(with-meta x (apply f (meta x) args)))
3 changes: 3 additions & 0 deletions tests/pixie/tests/test-stdlib.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -691,3 +691,6 @@
(t/assert= m (map-entry :a 1))
(t/assert= m [:a 1])
(t/assert= m '(:a 1))))

(t/deftest test-vary-meta
(t/assert= 42 (-> {} (vary-meta assoc :foo 42) meta :foo)))