From 2a49aed1f296ecff5bfe9453e99ff7915bba2137 Mon Sep 17 00:00:00 2001 From: tslil Date: Mon, 13 Oct 2025 20:51:16 +0100 Subject: e makes sense in many places, B should join the party in structural --- rprt.md | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/rprt.md b/rprt.md index e34e9cf..5f45ef1 100644 --- a/rprt.md +++ b/rprt.md @@ -27,7 +27,7 @@ Selection functions produce Selection outputs and take zero (nullary functions), ## 2.1 Core Selection Functions -There are ten core selection functions in RPRT. Seven have nullary and monadic forms. Two (`e`, `B`) have nullary form only. The function `-` additionally has dyadic semantics---it is the only selection function that may take two arguments. +There are ten core selection functions in RPRT. All ten have nullary and monadic forms, while the function `-` additionally has dyadic semantics---it is the only selection function that may take two arguments. | Function | Nullary semantics | Output rank | |------------|------------------------------------------------------------|-------------| @@ -43,19 +43,17 @@ There are ten core selection functions in RPRT. Seven have nullary and monadic f In the monadic case, all defined functions are rank preserving. Their action on ranks > 1 are given by broadcasting, that is, `α F` where `α` has rank 2 is computed by applying `F` to each rank 1 range in `α` and collecting the results into a list of ranges, mutatis mutandis for rank 3. -**Note:** The functions `eB` have no monadic or dyadic forms. To use them as such is an error condition. - -**Note:** When the input has rank 0 (position), all defined monadic functions are the identity since positions have no internal structure within which to search or operate. - -| Function | Semantics for rank 1 `α` | -|-----------|--------------------------| -| `α /re/` | First re within `α` | -| `α x/re/` | All re within`α` | -| `α $` | End position of`α` | -| `α #n` | Char n within`α` | -| `α n` | Line n within`α` | -| `α +n` | Line n within`α` | -| `α -` | Identity | +| Function | Semantics for rank 0 `α` | Semantics for rank 1 `α` | +|-----------|----------------------------------|------------------------------------------| +| `α e` | Empty selection (rank 2) | Empty selection (rank 2) | +| `α $` | `α` | End position of `α` | +| `α #n` | `α` | Char n within `α` | +| `α n` | `α` | Line n within `α` | +| `α /re/` | `α` | First re within `α` | +| `α x/re/` | `α` | All re within `α` | +| `α +n` | `α` | Line n within `α` | +| `α B/re/` | Buffer matches `re`? `α` : empty | buffer matches `re`? `α` : empty | +| `α -` | Range from `α` to end of buffer | Range from start of `α` to end of buffer | The span function `-` is the only selection function with dyadic semantics. It creates ranges by spanning from one selection to another. @@ -81,10 +79,11 @@ Operators take functions as arguments and return new functions. The reverse operator `'` takes a selection function and reverses its direction. -**Note:** `'F` is not defined when `F` is one of the functions `e-B` . +**Note:** `'F` is not defined when `F` is one of the functions `B-` . | Function | Nullary | Rank | |----------|--------------------------------|------| +| `'e` | synonymous with `e` | 2 | | `'$` | Start of buffer (position 0) | 0 | | `'#n` | Character n from end of buffer | 0 | | `'n` | Line n from end of buffer | 1 | @@ -94,16 +93,16 @@ The reverse operator `'` takes a selection function and reverses its direction. In the monadic case, all functions are rank preserving, and all of the above functions are the identity on rank 0 inputs. Their action on ranks > 1 is by broadcasting. -| Function | Semantics for rank 1 `α` | -|------------|----------------------------------| -| `α '$` | Start position of `α` | -| `α '#n` | Char n from end of `α` | -| `α 'n` | Line n from end of `α` | -| `α '/re/` | First match backward within `α` | -| `α 'x/re/` | All matches right-to-left in `α` | -| `α '+n` | Line -n within `α` | +| Function | Semantics for rank 0 `α` | Semantics for rank 1 `α` | +|------------|--------------------------|----------------------------------| +| `α 'e` | Empty selection (rank 2) | Empty selection (rank 2) | +| `α '$` | `α` | Start position of `α` | +| `α '#n` | `α` | Char n from end of `α` | +| `α 'n` | `α` | Line n from end of `α` | +| `α '/re/` | `α` | First match backward within `α` | +| `α 'x/re/` | `α` | All matches right-to-left in `α` | +| `α '+n` | `α` | Line -n within `α` | -**Note:** When the input has rank 0 (position), all defined reversed monadic functions are the identity since positions have no internal structure within which to search or operate. ### 2.2.2 The Sequential Operator `;` @@ -111,10 +110,11 @@ The sequential operator `;` transforms a selection function from operating "with **Note:** It is erroneous to use `;F` in the nullary case. TODO: or are there interesting semantics? -**Note:** `;F` is not defined when `F` is one of `e-B` . +**Note:** `;F` is not defined when `F` is one of `B-` . | Function | Semantics for rank 0 `α` | Semantics for rank 1 `α` | |------------|------------------------------|-------------------------------------| +| `α ;e` | Empty selection (rank 2) | Empty selection (rank 2) | | `α ;$` | End of buffer | End of buffer (ignores `α`) | | `α ;#n` | Character n after `α` | Character n after end of `α` | | `α ;n` | Line n after `α` | Line n after end of `α` | -- cgit v1.2.3