From c90358fb92ee7cc37debc37584dd9ac71b7e9c44 Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 09:40:29 -0400 Subject: [PATCH 01/17] Document map-keys. --- List-of-Navigators.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index e11059f..e1089fa 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -10,6 +10,7 @@ - [END](#end) - [FIRST](#first) - [LAST](#last) + - [MAP-KEYS](#map-keys) - [MAP-VALS](#map-vals) - [META](#meta) - [NIL->LIST](#nil-list) @@ -168,6 +169,15 @@ nil nil ``` +## MAP-KEYS + +`MAP-KEYS` navigates to every key in a map. `MAP-VALS` is more efficient than `[ALL FIRST]`. + +```clojure +=> (select [MAP-KEYS] {:a 3 :b 4}) +[:a :b] +``` + ## MAP-VALS `MAP-VALS` navigates to every value in a map. `MAP-VALS` is more efficient than `[ALL LAST]`. From 72d05e9447642d7ab26a522b9b8c616dfb719823 Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 09:45:00 -0400 Subject: [PATCH 02/17] Document NAME. --- List-of-Navigators.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index e1089fa..345d2bc 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -13,6 +13,7 @@ - [MAP-KEYS](#map-keys) - [MAP-VALS](#map-vals) - [META](#meta) + - [NAME](#name) - [NIL->LIST](#nil-list) - [NIL->SET](#nil-set) - [NIL->VECTOR](#nil-vector) @@ -204,6 +205,17 @@ the structure has no metadata or may not contain metadata. {:meta :datum} ``` +## NAME + +Navigates to the name of a keyword. + +```clojure +=> (select [NAME] :key) +["key"] +=> (select [MAP-KEYS NAME] {:a 3 :b 4 :c 5}) +["a" "b" "c"] +``` + ## NIL->LIST `NIL->LIST` navigates to the empty list `'()` if the value is nil. Otherwise it stays at the current value. From c97d0edaca7cbb6f62d0b95ff47cca17428f3d39 Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 10:01:47 -0400 Subject: [PATCH 03/17] Document NAMESPACE. --- List-of-Navigators.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index 345d2bc..49120b5 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -14,6 +14,7 @@ - [MAP-VALS](#map-vals) - [META](#meta) - [NAME](#name) + - [NAMESPACE](#namespace) - [NIL->LIST](#nil-list) - [NIL->SET](#nil-set) - [NIL->VECTOR](#nil-vector) @@ -216,6 +217,17 @@ Navigates to the name of a keyword. ["a" "b" "c"] ``` +## NAMESPACE + +Navigates to the namespace of keywords or variables. + +```clojure +=> (select [ALL NAMESPACE] [::test ::fun]) +["playground.specter" "playground.specter"] +=> (select [ALL NAMESPACE] [::test :fun]) +["playground.specter" nil] +``` + ## NIL->LIST `NIL->LIST` navigates to the empty list `'()` if the value is nil. Otherwise it stays at the current value. From 12472fa5996aedbe7a9dd6762a7f1074b33dad0e Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 10:06:17 -0400 Subject: [PATCH 04/17] Document INDEXED-VALS. --- List-of-Navigators.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index 49120b5..a4358ff 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -9,6 +9,7 @@ - [DISPENSE](#dispense) - [END](#end) - [FIRST](#first) + - [INDEXED-VALS](#indexed-vals) - [LAST](#last) - [MAP-KEYS](#map-keys) - [MAP-VALS](#map-vals) @@ -154,6 +155,19 @@ nil nil ``` +## INDEXED-VALS + +Navigates to [index elem] pairs for each element in a sequence. Transforms of index move element at that index to the new index, shifting other elements in the sequence. Indices seen during transform take into account any shifting from prior sequence elements changing indices. + +```clojure +=> (select [INDEXED-VALS] [1 2 3 4 5]) +[[0 1] [1 2] [2 3] [3 4] [4 5]] +=> (setval [INDEXED-VALS FIRST] 0 [1 2 3 4 5]) +[5 4 3 2 1] +=> (setval [INDEXED-VALS FIRST] 1 [1 2 3 4 5]) +[1 5 4 3 2] +``` + ## LAST `LAST` navigates to the last element of a collection. If the collection is a map, returns a key-value pair `[key value]`. If the collection is empty, navigation stops. From a9b0996e7839070e446aee35a049452a7dde1a46 Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 10:19:02 -0400 Subject: [PATCH 05/17] Document set-elem. --- List-of-Navigators.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index a4358ff..5471812 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -42,6 +42,7 @@ - [putval](#putval) - [not-selected?](#not-selected) - [selected?](#selected) + - [set-elem](#set-elem) - [srange](#srange) - [srange-dynamic](#srange-dynamic) - [stay-then-continue](#stay-then-continue) @@ -649,6 +650,22 @@ See also [not-selected?](#not-selected?). nil ``` +## set-elem + +`(set-elem element)` + +Navigates to the given element in the set only if it exists in the set. +Can transform to NONE to remove the element from the set. + +```clojure +=> (select [(set-elem 3)] #{3 4 5}) +[3] +=> (select [(set-elem 3)] #{4 5}) +[] +=> (setval [(set-elem 3)] NONE #{3 4 5}) +#{4 5} +``` + ## srange `(srange start end)` From 632770f10455c9d2a98bce5dfe65b7306804431a Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 10:26:45 -0400 Subject: [PATCH 06/17] Document nthpath. --- List-of-Navigators.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index 5471812..147e866 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -37,6 +37,7 @@ - [multi-path](#multi-path) - [must](#must) - [nil->val](#nil-val) + - [nthpath](#nthpath) - [parser](#parser) - [pred](#pred) - [putval](#putval) @@ -555,6 +556,21 @@ navigated at the structure. :b ``` +## nthpath + +`(nthpath index)` + +Navigate to the specified indices (one after another). Transform to NONE to remove the element from the sequence. + +```clojure +=> (select [(nthpath 0)] [1 2 3]) +[1] +=> (select [(nthpath 2)] [1 2 3]) +[3] +=> (setval [(nthpath 2)] NONE [1 2 3]) +[1 2] +``` + ## parser `(parser parse-fn unparse-fn)` From 7af9c7cb0023d4e19ab64076cf7f093205baf909 Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 10:46:16 -0400 Subject: [PATCH 07/17] Document index-nav. --- List-of-Navigators.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index 147e866..2e3eb93 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -33,6 +33,7 @@ - [continuous-subseqs](#continuous-subseqs) - [filterer](#filterer) - [if-path](#if-path) + - [index-nav](#index-nav) - [keypath](#keypath) - [multi-path](#multi-path) - [must](#must) @@ -489,6 +490,22 @@ See also [if-path](#if-path) () ``` +## index-nav + +Navigates to the index of the sequence if within 0 and size. Transforms move element +at that index to the new index, shifting other elements in the sequence. + +`(index-nav index)` + +```clojure +=> (select [(index-nav 0)] [1 2 3 4 5]) +[0] +=> (select [(index-nav 7)] [1 2 3 4 5]) +[] +=> (setval (index-nav 2) 0 [1 2 3 4 5]) +[3 1 2 4 5] +``` + ## keypath `(keypath key)` From be39002574a1f31363b3486ae31170e23c51fa64 Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 10:49:29 -0400 Subject: [PATCH 08/17] Add specification of names. --- List-of-Navigators.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index 2e3eb93..b696f99 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -160,7 +160,7 @@ nil ## INDEXED-VALS -Navigates to [index elem] pairs for each element in a sequence. Transforms of index move element at that index to the new index, shifting other elements in the sequence. Indices seen during transform take into account any shifting from prior sequence elements changing indices. +`INDEXED-VALS` navigates to [index elem] pairs for each element in a sequence. Transforms of index move element at that index to the new index, shifting other elements in the sequence. Indices seen during transform take into account any shifting from prior sequence elements changing indices. ```clojure => (select [INDEXED-VALS] [1 2 3 4 5]) @@ -225,7 +225,7 @@ the structure has no metadata or may not contain metadata. ## NAME -Navigates to the name of a keyword. +`NAME` navigates to the name of a keyword. ```clojure => (select [NAME] :key) @@ -236,7 +236,7 @@ Navigates to the name of a keyword. ## NAMESPACE -Navigates to the namespace of keywords or variables. +`NAMESPACE` navigates to the namespace of keywords or variables. ```clojure => (select [ALL NAMESPACE] [::test ::fun]) @@ -302,7 +302,7 @@ nil ## VAL -Collects the current structure. +`VAL` collects the current structure. See also [collect](#collect), [collect-one](#collect-one), and [putval](#putval) From 0435612e5473be1ffaa76f6ac1e4d7b7ae3df719 Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 10:51:50 -0400 Subject: [PATCH 09/17] Document AFTER-ELEM. --- List-of-Navigators.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index b696f99..3bd2cf5 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -3,6 +3,7 @@ **Table of Contents** - [Unparameterized Navigators](#unparameterized-navigators) + - [AFTER-ELEM](#after-elem) - [ALL](#all) - [ATOM](#atom) - [BEGINNING](#beginning) @@ -63,6 +64,15 @@ # Unparameterized Navigators +## AFTER-ELEM + +`AFTER-ELEM` navigates to the 'void' element after the sequence. For transformations – if result is not `NONE`, then append that value. + +``` +=> (setval AFTER-ELEM 3 [1 2]) +[1 2 3] +``` + ## ALL `ALL` navigates to every element in a collection. If the collection is a map, it will navigate to each key-value pair `[key value]`. From 8d265f33a79d2a7756753baac51b02c129c79aea Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 10:53:28 -0400 Subject: [PATCH 10/17] Document BEFORE-ELEM. --- List-of-Navigators.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index 3bd2cf5..0deb7c5 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -6,6 +6,7 @@ - [AFTER-ELEM](#after-elem) - [ALL](#all) - [ATOM](#atom) + - [BEFORE-ELEM](#before-elem) - [BEGINNING](#beginning) - [DISPENSE](#dispense) - [END](#end) @@ -104,6 +105,15 @@ 2 ``` +## BEFORE-ELEM + +`BEFORE-ELEM` navigates to the 'void' element before the sequence. For transformations – if result is not `NONE`, then prepend that value. + +```clojure +=> (setval BEFORE-ELEM 3 [1 2]) +[3 1 2] +``` + ## BEGINNING `BEGINNING` navigates to the empty subsequence before the beginning of a collection. Useful with `setval` to add values onto the beginning of a sequence. From 161a616ada0713b4a3d77705deb9365a7b10143d Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 10:57:20 -0400 Subject: [PATCH 11/17] Document NON-ELEM. --- List-of-Navigators.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index 0deb7c5..10f3edf 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -21,6 +21,7 @@ - [NIL->LIST](#nil-list) - [NIL->SET](#nil-set) - [NIL->VECTOR](#nil-vector) + - [NONE-ELEM](#none-elem) - [STAY](#stay) - [STOP](#stop) - [VAL](#val) @@ -298,6 +299,17 @@ the structure has no metadata or may not contain metadata. :foo ``` +## NONE-ELEM + +`NONE-ELEM` navigates to the 'void' elem in a set. For transformations - if the result is not `NONE`, then add that value to the set. + +``` +=> (setval NONE-ELEM 3 #{1 2}) +#{1 2 3} +=> (setval NONE-ELEM 1 nil) +#{1} +``` + ## STAY `STAY` stays in place. It is the no-op navigator. From 8a55ebccc035e344c42009ce35d42d65b87aa74b Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 11:06:45 -0400 Subject: [PATCH 12/17] Document map-key. --- List-of-Navigators.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index 10f3edf..980b050 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -38,6 +38,7 @@ - [if-path](#if-path) - [index-nav](#index-nav) - [keypath](#keypath) + - [map-key](#map-key) - [multi-path](#multi-path) - [must](#must) - [nil->val](#nil-val) @@ -558,6 +559,33 @@ See also [must](#must) [0 :boo] ``` +## map-key + +`(map-key key)` + +Navigates to the given key in the map (not to the value). + +```clojure +=> (select [(map-key :a)] {:a 2 :b 3}) +[:a] +=> (setval [(map-key :a)] :c {:a 2 :b 3}) +{:b 3, :c 2} +``` + +Navigates only if the key currently exists in the map. + +```clojure +=> (select [(map-key :z)] {:a 2 :b 3}) +[] +``` + +Can transform to NONE to remove the key/value pair from the map. + +```clojure +=> (setval [(map-key :a)] NONE {:a 2 :b 3}) +{:b 3} +``` + ## multi-path `(multi-path & paths)` From cc79aa51bea607cb8ed5a167a41266ea4d913ef8 Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 11:14:31 -0400 Subject: [PATCH 13/17] Document before-index. --- List-of-Navigators.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index 980b050..9eb9968 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -26,6 +26,7 @@ - [STOP](#stop) - [VAL](#val) - [Parameterized Navigators (and Functions)](#parameterized-navigators-and-functions) + - [before-index](#before-index) - [codewalker](#codewalker) - [collect](#collect) - [collect-one](#collect-one) @@ -349,6 +350,30 @@ See also [collect](#collect), [collect-one](#collect-one), and [putval](#putval) # Parameterized Navigators (and Functions) +## before-index + +`(before-index index)` + +Navigates to the empty space between the index and the prior index. Selects navigate to NONE. + +```clojure +=> (select-any (before-index 0) [1 2 3]) +:com.rpl.specter.impl/NONE +``` + +Transforms to non-NONE insert at the index position. + +``` +=> (setval (before-index 0) :a [1 2 3]) +[:a 1 2 3] +=> (setval (before-index 1) NONE [1 2 3]) +[1 2 3] +=> (setval (before-index 1) :a [1 2 3]) +[1 :a 2 3] +=> (setval (before-index 3) :a [1 2 3]) +[1 2 3 :a] +``` + ## codewalker `(codewalker afn)` From d53a3c21fd4e4bedd08a1b38973790b75454a3ca Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 11:22:08 -0400 Subject: [PATCH 14/17] Document string navigation. --- List-of-Navigators.md | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index 9eb9968..f550575 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -134,6 +134,15 @@ ([:foo :baz] [:foo :bar]) ``` +As of Specter 1.0.0, `BEGINNING` can now work with strings. It navigates to or transforms substrings. + +```clojure +=> (select-any BEGINNING "abc") +"" +=> (setval BEGINNING "b" "a") +"ba" +``` + ## DISPENSE _Added in 0.12.0_ @@ -164,6 +173,15 @@ Drops all collected values for subsequent navigation. ([:foo :bar] [:foo :baz]) ``` +As of Specter 1.0.0, `END` can now work with strings. It navigates to or transforms substrings. + +```clojure +=> (select-any END "abc") +"" +=> (setval END "b" "a") +"ab" +``` + ## FIRST `FIRST` navigates to the first element of a collection. If the collection is a map, returns a key-value pair `[key value]`. If the collection is empty, navigation stops. @@ -181,6 +199,15 @@ nil nil ``` +As of Specter 1.0.0, `FIRST` can now work with strings. It navigates to or transforms characters. + +```clojure +=> (select-any FIRST "abc") +\a +=> (setval FIRST \q "abc") +"qbc" +``` + ## INDEXED-VALS `INDEXED-VALS` navigates to [index elem] pairs for each element in a sequence. Transforms of index move element at that index to the new index, shifting other elements in the sequence. Indices seen during transform take into account any shifting from prior sequence elements changing indices. @@ -211,6 +238,15 @@ nil nil ``` +As of Specter 1.0.0, `LAST` can now work with strings. It navigates to or transforms characters. + +```clojure +=> (select-any LAST "abc") +\c +=> (setval LAST "q" "abc") +"abq" +``` + ## MAP-KEYS `MAP-KEYS` navigates to every key in a map. `MAP-VALS` is more efficient than `[ALL FIRST]`. @@ -802,6 +838,17 @@ IndexOutOfBoundsException (0 1 4) ``` +As of Specter 1.0.0, `srange` can now work with strings. It navigates to or transforms substrings. + +```clojure +=> (select-any (srange 1 3) "abcd") +"bc" +=> (setval (srange 1 3) "" "abcd") +"ad" +=> (setval [(srange 1 3) s/END] "x" "abcd") +"abcxd" +``` + ## srange-dynamic `(srange-dynamic start-fn end-fn)` From 57f35a2234618f90d431dab93c9b66569d9e8d24 Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 11:34:31 -0400 Subject: [PATCH 15/17] Document traversed. --- List-of-Navigators.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index f550575..b9f59a6 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -1000,6 +1000,18 @@ See also [view](#view) (0 1 1 3 2 5 3 7 4 9) ``` +## traversed + +`(traversed path reduce-fn)` + +Navigates to a view of the current value by transforming with a reduction over +the specified traversal. + +```clojure +=> (select-any (traversed ALL +) [1 2 3 4]) +10 +``` + ## view `(view afn)` From fc89c47a13a7dc90f132ee69cf0b17917e3fbb35 Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 11:43:12 -0400 Subject: [PATCH 16/17] Document pred= and co. --- List-of-Navigators.md | 65 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index b9f59a6..32dd033 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -743,6 +743,71 @@ See also [must](#must). [0 2 4 6 8] ``` +## pred= + +`(pred= value)` + +Keeps elements only if they equal the provided value. + +See also [pred](#pred). + +```clojure +=> (select [ALL (pred= 2)] [1 2 2 3 4 0]) +[2 2] +``` + +## pred< + +`(pred< value)` + +Keeps elements only if they are less than the provided value. + +```clojure +=> (select [ALL (pred< 3)] [1 2 2 3 4 0]) +[1 2 2 0] +``` + +See also [pred](#pred). + +## pred> + +`(pred> value)` + +Keeps elements only if they are greater than the provided value. + +```clojure +=> (select [ALL (pred> 3)] [1 2 2 3 4 0]) +[4] +``` + +See also [pred](#pred). + +## pred<= + +`(pred<= value)` + +Keeps elements only if they are less than the provided value. + +```clojure +=> (select [ALL (pred<= 3)] [1 2 2 3 4 0]) +[1 2 2 3 0] +``` + +See also [pred](#pred). + +## pred>= + +`(pred>= value)` + +Keeps elements only if they are greater than the provided value. + +```clojure +=> (select [ALL (pred>= 3)] [1 2 2 3 4 0]) +[3 4] +``` + +See also [pred](#pred). + ## putval `(putval val)` From 2d0a3192c53ad92aa9844d3a4ecdefc2a49da45a Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 11:48:18 -0400 Subject: [PATCH 17/17] Document transform to NONE. --- List-of-Navigators.md | 44 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/List-of-Navigators.md b/List-of-Navigators.md index 32dd033..4dda3d8 100644 --- a/List-of-Navigators.md +++ b/List-of-Navigators.md @@ -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" ```