Document transform to NONE.

This commit is contained in:
Michael Fogleman 2017-09-11 11:48:18 -04:00
parent fc89c47a13
commit 2d0a3192c5

View file

@ -92,6 +92,13 @@
{:a :b, :c :d}
```
`ALL` can transform to `NONE` to remove elements.
```clojure
=> (setval [ALL nil?] NONE [1 2 nil 3 nil])
[1 2 3]
```
## ATOM
`ATOM` navigates to the value of an atom.
@ -199,6 +206,13 @@ nil
nil
```
`FIRST` can transform to `NONE` to remove elements.
```clojure
=> (setval FIRST NONE [:a :b :c :d :e])
[:b :c :d :e]
```
As of Specter 1.0.0, `FIRST` can now work with strings. It navigates to or transforms characters.
```clojure
@ -238,6 +252,13 @@ nil
nil
```
`LAST` can transform to `NONE` to remove elements.
```clojure
=> (setval LAST NONE [:a :b :c :d :e])
[:a :b :c :d]
```
As of Specter 1.0.0, `LAST` can now work with strings. It navigates to or transforms characters.
```clojure
@ -267,6 +288,13 @@ As of Specter 1.0.0, `LAST` can now work with strings. It navigates to or transf
(:c :f)
```
`MAP-VALS` can transform to `NONE` to remove elements.
```clojure
=> (setval [MAP-VALS even?] NONE {:a 1 :b 2 :c 3 :d 4})
{:a 1 :c 3}
```
## META
_Added in 0.12.0_
@ -620,6 +648,13 @@ See also [must](#must)
[0 :boo]
```
`keypath` can transform to `NONE` to remove elements.
```clojure
=> (setval [(keypath :a)] NONE {:a 3 :b 4})
{:b 4}
```
## map-key
`(map-key key)`
@ -680,6 +715,13 @@ See also [keypath](#keypath) and [pred](#pred).
nil
```
`must` can transform to `NONE` to remove elements.
```clojure
=> (setval (must :a) NONE {:a 1 :b 2})
{:b 2}
```
## nil->val
`(nil->val v)`
@ -910,7 +952,7 @@ As of Specter 1.0.0, `srange` can now work with strings. It navigates to or tran
"bc"
=> (setval (srange 1 3) "" "abcd")
"ad"
=> (setval [(srange 1 3) s/END] "x" "abcd")
=> (setval [(srange 1 3) END] "x" "abcd")
"abcxd"
```