aboutsummaryrefslogtreecommitdiff
path: root/rprt.md
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2026-03-22 18:12:32 +0000
committertslil <tslil@posteo.de>2026-03-22 18:15:01 +0000
commit5ee9f5e935e147e5f16801a9cbe461f0585c6ba8 (patch)
tree26519b235a824039437e9fb03428be055c726479 /rprt.md
parent2d088bbe29626c26dba0c1d0290c16c1df7f16b8 (diff)
clarify text situation, only three ranks
Diffstat (limited to 'rprt.md')
-rw-r--r--rprt.md56
1 files changed, 31 insertions, 25 deletions
diff --git a/rprt.md b/rprt.md
index 9878bf9..8921935 100644
--- a/rprt.md
+++ b/rprt.md
@@ -8,18 +8,25 @@ A compositional, point-free language for text manipulation.
All functions work with two core types:
-1. **Selection** — addresses and regions in buffers
+1. **Selection** - addresses and regions in buffers
- Every selection exists within one or more buffers. Selections have a rank:
+Every selection exists within one or more buffers. Selections have a rank:
- - **Rank 0**: Position — a natural number offset within a single buffer
- - **Rank 1**: Range — a pair of positions `[start, end)` with capture groups, within a single buffer
- - **Rank 2**: Ranges — a list of ranges with capture groups, within a single buffer
- - **Rank 3**: Multi-buffer selection — a mapping from buffer identifiers to rank 2 selections
+- **Rank 0**: Position - a natural number offset within a single buffer
+- **Rank 1**: Range - a pair of positions `[start, end)` with capture groups, within a single buffer
+- **Rank 2**: Ranges - a list of ranges with capture groups, within a single buffer
+- **Rank 3**: Multi-buffer selection - a mapping from buffer identifiers to rank 2 selections
- Ranks 0-2 operate within a single buffer (typically the current buffer). Rank 3 is distinguished by spanning multiple buffers simultaneously.
+Ranks 0-2 operate within a single buffer (typically the current buffer). Rank 3 is distinguished by spanning multiple buffers simultaneously.
-2. **Text** — string data
+2. **Text** - string data
+
+Text has three ranks:
+- **Rank 1**: A single string
+- **Rank 2**: A list of strings
+- **Rank 3**: A mapping from buffer identifiers to lists of strings
+
+Unlike Selection, Text has no meaningful need to distinguish rank 0: a single character is simply a rank 1 string of length one.
### Function Types
@@ -33,12 +40,12 @@ Following APL conventions, functions may have nullary, monadic, and dyadic forms
When a Text argument is required, a Selection is implicitly coerced to Text by extracting its contents. This coercion has no side effects.
-| Input rank | Coerced Text |
-|------------|---------------------------------------------------|
-| 0 | Empty string (position has no extent) |
-| 1 | Contents of the range |
-| 2 | Contents of each range (multiple text values) |
-| 3 | Contents per buffer per range (multiple values) |
+| Input rank | Coerced Text |
+|------------|-----------------------------------------------------------------------|
+| 0 | The character at that position, or empty string at end of buffer |
+| 1 | Contents of the range |
+| 2 | Contents of each range (multiple text values) |
+| 3 | Contents per buffer per range (multiple values) |
For ranks 2 and 3, the selection provides multiple text values. Text functions pair these values with selection ranges following the broadcasting rules in §1.2.
@@ -226,18 +233,18 @@ In the niladic form this is `(.) /re/` (left hook semantics §1.2, or left assoc
Operators take functions as arguments and return new functions. Selection function operators fall into two categories which compose in a restricted manner:
**Search Modifiers** (at most one allowed):
-- _(none)_ — Unmodified search semantics (see §2.1)
-- `'` — Reverse (§2.2.2)
-- `;` — Sequential (§2.2.3)
-- `';` — Reverse-Sequential
-- `;'` — Sequential-Reverse
+- _(none)_ - Unmodified search semantics (see §2.1)
+- `'` - Reverse (§2.2.2)
+- `;` - Sequential (§2.2.3)
+- `';` - Reverse-Sequential
+- `;'` - Sequential-Reverse
**Result Transformations** (at most one allowed):
-- _(none)_ — Unmodified result
-- `~` — Complement (§2.2.4)
-- `?` — Conditional (§2.2.5)
-- `~?` — Complement-Conditional
-- `?~` — Conditional-Complement
+- _(none)_ - Unmodified result
+- `~` - Complement (§2.2.4)
+- `?` - Conditional (§2.2.5)
+- `~?` - Complement-Conditional
+- `?~` - Conditional-Complement
A fully-specified selection function has the form:
@@ -380,7 +387,6 @@ Text operations follow the broadcasting rules described in §1.2. When the text
| `τ \|` | Run `τ` | Return selection of ephemeral buffer output |
**Note:** The text argument `τ` may be a string literal or a Selection (which coerces to Text).
-**Note:** `\|` and `d` are undefined when the rank of `τ` is 0.
| Function | Effect | Semantics |
|----------|------------------------------------------------------|-----------------------------------------------------------|