Specter 0.12.0 has been released with many new features, performance
improvements, and bug fixes. There are a few highlights:
1. Performance of `select` has been greatly improved. Specter no longer
creates intermediate vectors during navigation and has performance very
close to transducers (for overlapping use cases).
2. A new `traverse` operation has been added that lets you do
high-performance reductions over nested elements in a data structure. It
does so without materializing any intermediate sequences. For example, this
code adds up all the even values for :a keys in a sequence of maps:
(reduce + (traverse [ALL :a even?] [{:a 1} {:a 2 :b 3} {:a 4}]))
;; => 6
3. `multi-transform` operation has been added for doing multiple
transformations at one time. This leads to better performance when the
transforms overlap a lot in how they navigate to their values. For example:
(multi-transform
[ALL
ALL
MAP-VALS
(multi-path [:a (terminal inc)]
[:b :c (terminal-val 99)])]
data)
Note that this release changes the semantics of the select* path for
navigators, so if you have custom navigators those may need to be updated.
Otherwise, no updates are needed. See the docstring on the Navigator
protocol for more details.
Full list of changes:
* BREAKING CHANGE: Changed semantics of `Navigator` protocol `select*` in
order to enable very large performance improvements to `select`,
`select-one`, `select-first`, and `select-one!`. Custom navigators will
need to be updated to conform to the new required semantics. Codebases that
do not use custom navigators do not require any changes. See the docstring
on the protocol for the details.
* 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)
* Added DISPENSE navigator to drop all collected values for subsequent
navigation
* Added `collected?` macro to create a filter function which operates on
the collected values.
* Error now thrown if a pathedfn (like filterer) is used without being
parameterized
* Performance improvement for ALL and MAP-VALS on small maps for Clojure by
leveraging IMapIterable interface
* Added low-level `richnav` macro for creating navigators with full
flexibility
* Bug fix: multi-path and if-path now work properly with value collection
* Bug fix: END, BEGINNING, FIRST, LAST, and MAP-VALS now work properly on
nil
* Bug fix: ALL and MAP-VALS now maintain the comparator of sorted maps
* Bug fix: Using value collection along with `setval` no longer throws
exception
* Bug fix: Fix error when trying to use Specter along with AOT compilation
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.