From cc79aa51bea607cb8ed5a167a41266ea4d913ef8 Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Mon, 11 Sep 2017 11:14:31 -0400 Subject: [PATCH] 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)`