diff --git a/CHANGES.md b/CHANGES.md index ae865f6..e602a40 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,8 @@ * Added `select-any` operation which selects a single element navigated to by the path. Which element returned is undefined. If no elements are navigated to, returns `com.rpl.specter/NONE`. This is the fastest selection operation. * Added `selected-any?` operation that returns true if any element is navigated to. * Added `traverse` operation which returns a reducible object of all the elements navigated to by the path. Very efficient. +* Added `multi-transform` operation which can be used to perform multiple transformations in a single traversal. Much more efficient than doing the +transformations with `transform` one after another when the transformations share a lot of navigation. `multi-transform` is used in conjunction with `terminal` and `terminal-val` – see the docstring for details. * Huge performance improvements to `select`, `select-one`, `select-first`, and `select-one!` * Huge performance improvement to `multi-path` * Added META navigator (thanks @aengelberg) diff --git a/src/clj/com/rpl/specter.cljx b/src/clj/com/rpl/specter.cljx index 7471290..f143824 100644 --- a/src/clj/com/rpl/specter.cljx +++ b/src/clj/com/rpl/specter.cljx @@ -137,7 +137,8 @@ (defn multi-transform* "Just like `transform` but expects transform functions to be specified inline in the path using `terminal`. Error is thrown if navigation finishes - at a non-`terminal` navigator." + at a non-`terminal` navigator. `terminal-val` is a wrapper around `terminal` and is + the `multi-transform` equivalent of `setval`." [path structure] (compiled-multi-transform (i/comp-paths* path) structure)) diff --git a/src/clj/com/rpl/specter/macros.clj b/src/clj/com/rpl/specter/macros.clj index ad1b028..4322572 100644 --- a/src/clj/com/rpl/specter/macros.clj +++ b/src/clj/com/rpl/specter/macros.clj @@ -646,7 +646,8 @@ (defmacro multi-transform "Just like `transform` but expects transform functions to be specified inline in the path using `terminal`. Error is thrown if navigation finishes - at a non-`terminal` navigator. + at a non-`terminal` navigator. `terminal-val` is a wrapper around `terminal` and is + the `multi-transform` equivalent of `setval`. This macro will attempt to do inline factoring and caching of the path, falling back to compiling the path on every invocation if it's not possible to factor/cache the path."