From 4c2d3d4808827d12415e629bff27833c80de72d7 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 28 Sep 2026 05:22:14 +0100 Subject: 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. --- core/module.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core/module.h') 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; -- cgit v1.2.3