Specter is a library that supercharges your ability to work with regular 
Clojure data structures. Happy to announce I just released 1.0, a huge 
milestone for the project.

I also wrote a post about why I consider Specter to be Clojure's missing 
piece: http://nathanmarz.com/blog/clojures-missing-piece.html

This release implements the most requested feature for Specter, which is 
the ability to easily remove values from maps or sequences. Examples:

(setval [ALL nil?] NONE [1 2 nil 3 nil]) => [1 2 3]
(setval [:a (nthpath 1)] NONE {:a [1 2 3]}) => {:a [1 3]}
(setval [MAP-VALS even?] NONE {:a 1 :b 2 :c 3 :d 4}) => {:a 1 :c 3}
(setval FIRST NONE [1 2 3]) => [2 3]

This release also provides full integration with Clojure's transducers, 
allowing you to express many transducer operations much more elegantly:

;; Using Vanilla Clojure
(transduce
  (comp (map :a) (mapcat identity) (filter odd?))
  +
  [{:a [1 2]} {:a [3]} {:a [4 5]}])
;; => 9

;; The same logic expressed with Specter
(transduce
  (traverse-all [:a ALL odd?])
  +
  [{:a [1 2]} {:a [3]} {:a [4 5]}])

See the release notes and blog post for more details.



Release notes:

* Transform to `com.rpl.specter/NONE` to remove elements from data 
structures. Works with `keypath` (for both sequences and maps), `must`, 
`nthpath`, `ALL`, `MAP-VALS`, `FIRST`, and `LAST`
* Add `nthpath` navigator
* Add `with-fresh-collected` higher order navigator
* Added `traverse-all` which returns a transducer that traverses over all 
elements matching the given path.
* `select-first` and `select-any` now avoid traversal beyond the first 
value matched by the path (like when using `ALL`), so they are faster now 
for those use cases.
* Add `MAP-KEYS` navigator that's more efficient than `[ALL FIRST]`
* Add `NAME` and `NAMESPACE` navigators
* Extend `srange`, `BEGINNING`, `END` to work on strings. Navigates to a 
substring.
* Extend `FIRST` and `LAST` to work on strings. Navigates to a character.
* Add `BEFORE-ELEM` and `AFTER-ELEM` for prepending or appending a single 
element to a sequence
* Add `NONE-ELEM` to efficiently add a single element to a set
* Improved `ALL` performance for PersistentHashSet
* Dynamic navs automatically compile sequence returns if completely static
* Eliminate reflection warnings for clj (thanks @mpenet)
* Bug fix: Collected vals now properly passed to subpaths for `if-path`, 
`selected?`, and `not-selected?`
* Bug fix: `LAST`, `FIRST`, `BEGINNING`, and `END` properly transform 
subvector types to a vector type

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to