aboutsummaryrefslogtreecommitdiffstats
path: root/prototypes/connections/module.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-26 11:35:20 +0100
committereunhhu <[email protected]>2026-09-26 11:35:20 +0100
commit92f5545efb7aab0b3a4a4c73a65364ef519cd5d4 (patch)
tree10633f366478737d6bb25286ac074e7f4ded7b20 /prototypes/connections/module.h
parent6ca1a1e598b9aa2f0b8f3947c27883b45b366346 (diff)
downloadpure-92f5545efb7aab0b3a4a4c73a65364ef519cd5d4.tar.gz
pure-92f5545efb7aab0b3a4a4c73a65364ef519cd5d4.zip
Add first: the index of the first item a block keeps
A fifth fold kind, first, runs its block over the items until one leaves a non-zero number and pushes that item's index, typed as an index of the list, or fails not_found when none does. Handlers can so find the item to change by a condition, as a message naming a task by its title would.
Diffstat (limited to 'prototypes/connections/module.h')
-rw-r--r--prototypes/connections/module.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/prototypes/connections/module.h b/prototypes/connections/module.h
index b57e11f..4264710 100644
--- a/prototypes/connections/module.h
+++ b/prototypes/connections/module.h
@@ -43,8 +43,9 @@ typedef enum {
/* FOLD's argument: the kind (bits 0-7), the list state (8-15) and the length
* of the block that follows (16-31), run once per item as a column of that
* list. count counts the items whose block leaves a non-zero number; sum,
- * max and min take a value and an include flag from their block. */
-typedef enum { PURE_FOLD_COUNT, PURE_FOLD_SUM, PURE_FOLD_MAX, PURE_FOLD_MIN } PureFold;
+ * max and min take a value and an include flag from their block; first gives
+ * the index of the first item whose block leaves a non-zero number. */
+typedef enum { PURE_FOLD_COUNT, PURE_FOLD_SUM, PURE_FOLD_MAX, PURE_FOLD_MIN, PURE_FOLD_FIRST } PureFold;
typedef enum { PURE_KIND_KEY = 1, PURE_KIND_MESSAGE = 2, PURE_KIND_TEXT = 3 } PureInputKind;
typedef enum { PURE_FIELD_U32 = 1, PURE_FIELD_BYTES = 2 } PureFieldType;