aboutsummaryrefslogtreecommitdiffstats
path: root/core/module.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-28 05:22:14 +0100
committereunhhu <[email protected]>2026-09-28 05:22:14 +0100
commit4c2d3d4808827d12415e629bff27833c80de72d7 (patch)
treef797ab44d388dde428ac61aee7eb3c4321bfd61e /core/module.h
parent468ddde46c7904ae14e29444351a738de73f8864 (diff)
downloadpure-4c2d3d4808827d12415e629bff27833c80de72d7.tar.gz
pure-4c2d3d4808827d12415e629bff27833c80de72d7.zip
Slice a keyed list: fold and walk over a range of keys
A fold whose kind has PURE_FOLD_SLICED (128), and a walk whose argument has PURE_EACH_SLICED (bit 0), first take two numbers, a low and a high key, and run for the items of their list (keyed by a number) whose keys are from low up to before high, found by key: the range is the program's meaning, not an optimization, so their blocks may fault (items out of the slice never run). A fold a leaf at a time now leaves out the lanes of a leaf outside the items it runs for, and a leaf that would fault runs item by item over those items alone. Slices are neither shaped nor given automatic ranges. ranges now checks a count over a slice whose test divides (a division by zero failing it only when inside the slice) against a model, the same on the item-by-item path, and a walk over a slice.
Diffstat (limited to 'core/module.h')
-rw-r--r--core/module.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/module.h b/core/module.h
index a93cd69..6132e23 100644
--- a/core/module.h
+++ b/core/module.h
@@ -61,6 +61,11 @@ enum { PURE_MODULE_LOCALS = 64 };
* (distinct counts the different values, -0 as 0); 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, PURE_FOLD_DISTINCT } PureFold;
+/* A slice: a fold whose kind has PURE_FOLD_SLICED, or a walk whose argument
+ * has PURE_EACH_SLICED, first takes two numbers, a low and a high key, and
+ * runs for the items of its list (keyed by a number) whose keys are from
+ * low up to before high, found by key. */
+enum { PURE_FOLD_SLICED = 0x80, PURE_EACH_SLICED = 1 };
/* TEXT_COMPARE's argument: the relation, in the order of the number
* comparisons (LT LE GT GE EQ NE); texts order by their bytes. */
typedef enum { PURE_LESS, PURE_LESS_EQUAL, PURE_GREATER, PURE_GREATER_EQUAL, PURE_EQUAL, PURE_NOT_EQUAL } PureRelation;