core: jolt-cru — partition-all/partition-by transducer (1-arg) arities

(partition-all n) and (partition-by f) now return stateful transducers, so they
compose with into/sequence/transduce/comp (previously errored "called with 1
argument, expected 2"). Both buffer a window, emit on boundary, flush a partial
trailing window in the completion arity, and honor `reduced` (early stop drops
the in-progress window, no extra trailing partition) — matching Clojure.

partition-all: td-partition-all in core.janet (Janet, alongside the other td-*),
core-partition-all made variadic. partition-by: transducer arity added to the
overlay defn in Clojure with volatiles (stays with its lazy collection arity).

Gate: conformance 253x3 (+4 transducer cases incl comp + reduced), lazy-infinite
44/44, fixpoint, self-host, specs+unit green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yogthos 2026-06-08 18:13:49 -04:00
parent c7378f4be0
commit a68210e440
3 changed files with 68 additions and 13 deletions

View file

@ -303,6 +303,10 @@
["transduce remove" "[1 3 5]" "(into [] (remove even?) [1 2 3 4 5])"]
["transduce take-while" "[1 2]" "(into [] (take-while (fn [x] (< x 3))) [1 2 3 4 1])"]
["transduce map-indexed" "[[0 :a] [1 :b]]" "(into [] (map-indexed (fn [i x] [i x])) [:a :b])"]
["partition-all xform" "[[1 2] [3 4] [5]]" "(into [] (partition-all 2) [1 2 3 4 5])"]
["partition-all xform comp" "[2 2 1]" "(into [] (comp (partition-all 2) (map count)) [1 2 3 4 5])"]
["partition-by xform" "[[1 1] [2 4] [5]]" "(into [] (partition-by odd?) [1 1 2 4 5])"]
["partition-by xform reduced" "[[1 1] [2 4]]" "(into [] (comp (partition-by odd?) (take 2)) [1 1 2 4 5 5])"]
### ==== regex (capturing groups, backtracking, flags, lookahead) ====
["re-find groups" "[\"12-34\" \"12\" \"34\"]" "(re-find #\"(\\d+)-(\\d+)\" \"x12-34y\")"]