From f5f985d6f9ae11feba4289639a2751141931c6a2 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Fri, 30 Oct 2026 12:11:15 -0700 Subject: [PATCH 1/4] chore(quest): claim quest/m3/ts-set-ops.md Quest-Claim: 6d74af3846513f70 From 2c5f77b489123034376f8800ed10af4a3e5d8827 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Fri, 30 Oct 2026 12:49:47 -0700 Subject: [PATCH 2/4] feat(ts): translate set operations of hash and B-tree sets `union`, `intersection`, `difference`, and `symmetric_difference` of a `HashSet` and a `BTreeSet`, their operators `|`, `&`, `-`, and `^`, and `is_subset`, `is_superset`, and `is_disjoint` map to runtime functions that follow std's algorithms: a B-tree's merge or lookup by relative size, which picks which set's key of two equal ones is yielded, and a hash set's walk of the larger or smaller set. Each is lazy, and lends `[u8; N]` keys as slices. A set an operator builds has its root, so even empty it checks a range's bounds. Co-Authored-By: Claude Opus 5.5 --- quest/m3/README.md | 2 +- quest/m3/ts-array-map.md | 16 + quest/m3/ts-set-ops.md | 16 - ts/fixtures/lang/caller.ts | 18 +- .../lang/expected/collections.Nibble.ts | 4 + ts/fixtures/lang/expected/collections.ts | 909 +++++++++++++++++- ts/fixtures/lang/expected/harness.ts | 4 +- ts/fixtures/lang/src/collections.rs | 118 +++ ts/fixtures/lang/src/harness.rs | 1 + ts/runtime/rt/collections.ts | 267 ++++- ts/src/lower/collections.rs | 62 +- 11 files changed, 1392 insertions(+), 25 deletions(-) create mode 100644 quest/m3/ts-array-map.md delete mode 100644 quest/m3/ts-set-ops.md diff --git a/quest/m3/README.md b/quest/m3/README.md index 51216e681..2975eec55 100644 --- a/quest/m3/README.md +++ b/quest/m3/README.md @@ -27,7 +27,6 @@ generic std gap is planned here even when moq never calls it. - [Binding gaps](/quest/m3/ts-bind-gaps.md) - bound types as keys, unit returns checked, renamed dependencies - [A B-tree's drop order](/quest/m3/ts-btree-drop.md) - dropping a whole `BTreeMap` or `BTreeSet` drops its entries node by node, as std's does - [Drop order in std's folds and iterators](/quest/m3/ts-drop-order.md) - the values that drop still refused in std's folds, zips, flattens, and collects drop as std's do -- [Set operations](/quest/m3/ts-set-ops.md) - `union`, `intersection`, `difference`, and `symmetric_difference` of hash and B-tree sets translate - [References to byte arrays std takes](/quest/m3/ts-byte-refs-taken.md) - `extend` by references to arrays, adaptors' closures over held arrays, and a collection of both forms translate - [Size hints of std's iterators](/quest/m3/ts-size-hints.md) - `size_hint` translates, and `Vec`'s collect and extend panic past `isize::MAX` as std's do - [A closure's () result as a value](/quest/m3/ts-unit-closures.md) - a closure returning `()` whose result is a value, as in a `Vec<()>` collected from `map`, type-checks @@ -38,3 +37,4 @@ generic std gap is planned here even when moq never calls it. - [Waiting: a slice object for a mutable part of other values](/quest/m3/ts-slice-object.md) - waits on a moq profile showing the `Proxy` view's traps matter, then decides on an `rt.ByteSlice`-like form - [Port the workflow guard to kixelated/quest](/quest/m3/quest-workflow-guard.md) - quest's environment guard parses YAML as this repository's does - [A parameter read only where lowering leaves nothing](/quest/m3/ts-unread-params.md) - an instance whose lowering drops every read of a parameter marks it unused, so `tsc` accepts it +- [An array's map](/quest/m3/ts-array-map.md) - `<[T; N]>::map` translates, calling its closure on each element in order diff --git a/quest/m3/ts-array-map.md b/quest/m3/ts-array-map.md new file mode 100644 index 000000000..501c98a74 --- /dev/null +++ b/quest/m3/ts-array-map.md @@ -0,0 +1,16 @@ +# [S] An array's map + +## Goal + +`<[T; N]>::map` translates for every element type, its closure called on each element in +order, proven by a differential test against native Rust that covers `[u8; N]` results. + +## Plan + +Reproduced on `955ac19f`: `[bool; 3].map(u8::from)` is refused at its span as an +unsupported call to `std::array::::map`. A `[u8; N]` result is a +`Uint8Array`, as `array::from_fn`'s is. + +Found by [#302](https://github.com/moq-dev/rust2/pull/302). + +Public API: the translator's output. diff --git a/quest/m3/ts-set-ops.md b/quest/m3/ts-set-ops.md deleted file mode 100644 index 822568155..000000000 --- a/quest/m3/ts-set-ops.md +++ /dev/null @@ -1,16 +0,0 @@ -# [S] Set operations - -## Goal - -`union`, `intersection`, `difference`, and `symmetric_difference` of a `HashSet` and a -`BTreeSet` translate, each yielding what std's iterator yields in std's order for a -B-tree, proven by a differential test against native Rust that covers `[u8; N]` elements. - -## Plan - -Each is an unsupported call today for every element type. A hash set's order is the -runtime's, so the hash forms need only yield the same elements; a B-tree's merge order is -std's. Their items are `&T`, which the collection mappings already lend as a slice where -`T` is a `[u8; N]`. - -Public API: the translator's output. diff --git a/ts/fixtures/lang/caller.ts b/ts/fixtures/lang/caller.ts index 762d4e242..0b962fe3b 100644 --- a/ts/fixtures/lang/caller.ts +++ b/ts/fixtures/lang/caller.ts @@ -484,4 +484,20 @@ const iters = Array.from({ length: 12 }, (_, kind) => [[], [2, 7, 9, 14], [0, 2, const hintedOp = op("strs::hinted"); const hinted = Array.from({ length: 10 * 7 * 21 }, (_, i) => Uint8Array.of(hintedOp, i % 10, Math.floor(i / 10) % 7, Math.floor(i / 70))); -export const cases: Uint8Array[] = [...loops, ...durations, ...ints(), ...utf8, ...floats, ...formats, ...parsed, ...singlesCases, ...singlesFormats, ...singlesParsed, ...dyns, ...cells, ...shared, ...locks, ...onces, ...bounds, ...unsafeCells, ...edits, ...subslices, ...consumers, ...closures, ...elements, ...ranges, ...reducers, ...sliceEdits, ...drains, ...iters, ...hinted, ...peekedOthers]; +/** + * `collections::set_ops` of one key against 30, which std's B-tree looks up in the larger + * rather than merging, of each key type: a key below the rest, at either end, between, and + * above. Then `Nibble`s equal to another set's but for their high bits, of hash sets as + * large as each other and one larger, where std's picks which set's to yield by size. + */ +const setOpsOp = op("collections::set_ops"); +const setOps = [ + ...[12, 13, 14, 15].flatMap((kind) => [0x20, 0x21, 0x25, 0x3e, 0x3f].map((single) => Uint8Array.of(setOpsOp, kind, single, ...Array.from({ length: 30 }, (_, i) => 0x41 + i)))), + ...[ + [0x01, 0x02, 0x13, 0x21, 0x32, 0x44], + [0x01, 0x02, 0x13, 0x21, 0x32, 0x44, 0x55], + [0x01, 0x02, 0x13, 0x55, 0x21, 0x32, 0x44], + ].map((data) => Uint8Array.of(setOpsOp, 3, ...data)), +]; + +export const cases: Uint8Array[] = [...loops, ...durations, ...ints(), ...utf8, ...floats, ...formats, ...parsed, ...singlesCases, ...singlesFormats, ...singlesParsed, ...dyns, ...cells, ...shared, ...locks, ...onces, ...bounds, ...unsafeCells, ...edits, ...subslices, ...consumers, ...closures, ...elements, ...ranges, ...reducers, ...sliceEdits, ...drains, ...iters, ...hinted, ...peekedOthers, ...setOps]; diff --git a/ts/fixtures/lang/expected/collections.Nibble.ts b/ts/fixtures/lang/expected/collections.Nibble.ts index a558dff1e..e2c0c061f 100644 --- a/ts/fixtures/lang/expected/collections.Nibble.ts +++ b/ts/fixtures/lang/expected/collections.Nibble.ts @@ -22,4 +22,8 @@ export function cmp$Ord(self: Nibble, other: Nibble): rt.Ordering { return rt.cmp(other._0 & 15, self._0 & 15); } +export function partialCmp$PartialOrd(self: Nibble, other: Nibble): rt.Ordering | undefined { + return cmp$Ord(self, other); +} + //# sourceMappingURL=collections.Nibble.ts.map diff --git a/ts/fixtures/lang/expected/collections.ts b/ts/fixtures/lang/expected/collections.ts index a71883d6b..b3f680d29 100644 --- a/ts/fixtures/lang/expected/collections.ts +++ b/ts/fixtures/lang/expected/collections.ts @@ -1,7 +1,7 @@ // Generated by rust2-ts. Do not edit. import * as rt from "./rt.ts"; -import { copy$Bumped, copy$Tally, copy$Wrap_u8, copy$u8_Tally, copy$u8_u16, copy$u8_u16s, copy$u8_u8, copy$u8_u8s } from "./lib.ts"; +import { copy$Bumped, copy$Tally, copy$Wrap_u8, copy$u8_Tally, copy$u8_u16, copy$u8_u16s, copy$u8_u8, copy$u8_u8s, copy$u8s } from "./lib.ts"; import * as Clash from "./collections.Clash.ts"; import * as Cloned from "./collections.Cloned.ts"; import * as Dir from "./collections.Dir.ts"; @@ -12,7 +12,7 @@ import * as Pair from "./collections.Pair.ts"; import * as Rank from "./collections.Rank.ts"; import * as Tally from "./collections.Tally.ts"; import { thenSome$0d5am30 } from "./core/bool.ts"; -import { unwrapOr$1j4op5y, unwrapOr$0r2bmpr, map$0oc32h1, mapOr$0q0ymkh, mapOr$1to2ul4, mapOr$1ht002r, mapOr$099335t, mapOr$1surhce, mapOr$0mmpeqx, mapOr$1nlkf9b, clone$14nprly, flatten$1nwzx42 } from "./core/option.ts"; +import { unwrapOr$1j4op5y, unwrapOr$0r2bmpr, map$0oc32h1, mapOr$0q0ymkh, mapOr$1xztl8h, mapOr$1to2ul4, mapOr$1ht002r, mapOr$099335t, mapOr$1surhce, mapOr$0mmpeqx, mapOr$1nlkf9b, mapOr$1w1gbwl, clone$14nprly, flatten$1nwzx42 } from "./core/option.ts"; import * as Wrap from "./generics.Wrap.ts"; import * as Bumped from "./iters.Bumped.ts"; @@ -1572,4 +1572,909 @@ export function optionals(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): voi } } +/** + * `union`, `intersection`, `difference`, and `symmetric_difference` of two sets each way, + * by method and by operator, and whether one is a subset, superset, or disjoint from the + * other: of sets that overlap, are equal, are empty, are disjoint, or are one key against + * many, where std's B-tree searches the larger rather than merging. A B-tree's yield in + * its order, and the sets its operators build are read from both ends; a hash set's yield + * in the runtime's, so what each yields is sorted first. The `Nibble` an op yields shows + * which set's key of two equal ones std's picks. + */ +export function setOps(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { + const mid: number = rt.usizeDiv(data.length, 2); + if (mid > data.length) { + rt.panic("mid > len"); + } + let left: rt.ByteSlice = new rt.ByteSlice(data.data, data.start, mid); + let right: rt.ByteSlice = new rt.ByteSlice(data.data, data.start + mid, data.length - mid); + b0: { + const _12: rt.u8 = rt.u8Rem(rt.u8Div(kind, 4), 6); + if (_12 !== 0) { + if (_12 === 1) { + right = left; + } else if (_12 === 2) { + left = rt.byteSliceFrom(Uint8Array.of()); + } else if (_12 === 3) { + const mid2: number = rt.min(data.length, 1); + if (mid2 > data.length) { + rt.panic("mid > len"); + } + left = new rt.ByteSlice(data.data, data.start, mid2); + right = new rt.ByteSlice(data.data, data.start + mid2, data.length - mid2); + } else if (_12 === 4) { + const _23: rt.ByteVec = rt.iterToByteVec(rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (b: rt.u8): rt.u8 => { + return b & (~1 & 0xff); + })); + const _27: rt.ByteVec = rt.iterToByteVec(rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (b2: rt.u8): rt.u8 => { + return b2 | 1; + })); + left = rt.byteVecSlice(_23); + right = rt.byteVecSlice(_27); + } else { + const _39: rt.Iter = rt.iterSlice(rt.byteSliceView(data)); + const all: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmp) as rt.BTreeSet, _39, true); + const none: rt.BTreeSet = rt.btreeFromSorted(rt.btreeNew(rt.cmp) as rt.BTreeSet, rt.btreeDifference(all, all)); + const k: rt.u8 = unwrapOr$0r2bmpr(rt.byteSliceFirst(data), 0); + rt.byteVecPush(out, rt.iterCount(rt.btreeRangeKeys(none, [{ tag: "Excluded", _0: k } as rt.RangeBound, { tag: "Excluded", _0: k } as rt.RangeBound] as [rt.RangeBound, rt.RangeBound])) & 0xff); + break b0; + } + } + const _55: rt.u8 = rt.u8Rem(kind, 4); + if (_55 === 0) { + setOpsOf$u8(left, right, (b5: rt.u8): rt.u8 => { + return rt.u8Rem(b5, 32); + }, (v2: rt.u8): rt.u8 => { + return v2; + }, out); + } else if (_55 === 1) { + setOpsOf$u8s(left, right, (b4: rt.u8): Uint8Array => { + return Uint8Array.of(rt.u8Rem(b4, 4), rt.u8Rem(rt.u8Div(b4, 4), 4)); + }, (k2: rt.ByteSlice): rt.u8 => { + return ((k2.data[k2.start] << 4) & 0xff) | k2.data[k2.start + 1]; + }, out); + } else if (_55 === 2) { + setOpsOf$Option_u8(left, right, (b3: rt.u8): rt.u8 | undefined => { + return thenSome$0d5am30(rt.u8Rem(b3, 32) !== 0, rt.u8Rem(b3, 32)); + }, (v: rt.u8 | undefined): rt.u8 => { + return unwrapOr$0r2bmpr(v, 238); + }, out); + } else { + setOpsOf$Nibble(left, right, (a0: rt.u8): Nibble.Nibble => { + return { _0: a0 }; + }, (n: Nibble.Nibble): rt.u8 => { + return n._0; + }, out); + } + } +} + +export function setOpsOf$Nibble(left: rt.ByteSlice, right: rt.ByteSlice, make: (a0: rt.u8) => Nibble.Nibble, put: (a0: Nibble.Nibble) => rt.u8, out: rt.ByteVec): void { + const _7: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_2: rt.u8): Nibble.Nibble => { + return make(_2); + }); + const a: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, _7, true); + const _12: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_22: rt.u8): Nibble.Nibble => { + return make(_22); + }); + const b: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, _12, true); + const iter: rt.Iter<[rt.BTreeSet, rt.BTreeSet]> = rt.iterSlice([[a, b] as [rt.BTreeSet, rt.BTreeSet], [b, a] as [rt.BTreeSet, rt.BTreeSet]]); + while (true) { + const _25: [rt.BTreeSet, rt.BTreeSet] | rt.Done = iter.next(); + if (_25 === rt.DONE) { + break; + } + putAll$Nibble_Union_Nibble(rt.btreeUnion(_25[0], _25[1]), put, out); + putAll$Nibble_Intersection_Nibble(rt.btreeIntersection(_25[0], _25[1]), put, out); + putAll$Nibble_Difference_Nibble(rt.btreeDifference(_25[0], _25[1]), put, out); + putAll$Nibble_SymmetricDifference_Nibble(rt.btreeSymmetricDifference(_25[0], _25[1]), put, out); + rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.btreeUnion(_25[0], _25[1]).next()), 221, put)); + rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.btreeIntersection(_25[0], _25[1]).next()), 221, put)); + rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.btreeDifference(_25[0], _25[1]).next()), 221, put)); + rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.btreeSymmetricDifference(_25[0], _25[1]).next()), 221, put)); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.btreeIsSubset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsSuperset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsDisjoint(_25[0], _25[1]) ? 1 : 0))); + const iter2: rt.Iter> = rt.iterSlice([rt.btreeFromSorted(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, rt.btreeUnion(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, rt.btreeIntersection(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, rt.btreeDifference(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, rt.btreeSymmetricDifference(_25[0], _25[1]))]); + while (true) { + const _73: rt.BTreeSet | rt.Done = iter2.next(); + if (_73 === rt.DONE) { + break; + } + const built: rt.BTreeSet = _73; + putAll$Nibble_Iter_Nibble(rt.btreeKeys(built), put, out); + putAll$Nibble_Rev_Iter_Nibble(rt.iterRev(rt.btreeKeys(built)), put, out); + } + } + const _85: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): Nibble.Nibble => { + return make(_23); + }); + const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, _85); + const _90: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): Nibble.Nibble => { + return make(_24); + }); + const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, _90); + const iter3: rt.Iter<[rt.HashSet, rt.HashSet]> = rt.iterSlice([[a2, b2] as [rt.HashSet, rt.HashSet], [b2, a2] as [rt.HashSet, rt.HashSet]]); + while (true) { + const _103: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); + if (_103 === rt.DONE) { + break; + } + putSorted$Nibble(rt.iterToArray(rt.hashUnion(_103[0], _103[1])), put, out); + putSorted$Nibble(rt.iterToArray(rt.hashIntersection(_103[0], _103[1])), put, out); + putSorted$Nibble(rt.iterToArray(rt.hashDifference(_103[0], _103[1])), put, out); + putSorted$Nibble(rt.iterToArray(rt.hashSymmetricDifference(_103[0], _103[1])), put, out); + rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.hashUnion(_103[0], _103[1]).next()), 221, (v: Nibble.Nibble): rt.u8 => { + let _3!: boolean; + if (!rt.hashContains(_103[0], v)) { + _3 = rt.hashContains(_103[1], v); + } else { + _3 = true; + } + return _3 ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.hashIntersection(_103[0], _103[1]).next()), 221, (v2: Nibble.Nibble): rt.u8 => { + let _32!: boolean; + if (!rt.hashContains(_103[0], v2)) { + _32 = false; + } else { + _32 = rt.hashContains(_103[1], v2); + } + return _32 ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.hashDifference(_103[0], _103[1]).next()), 221, (v3: Nibble.Nibble): rt.u8 => { + return !rt.hashContains(_103[1], v3) ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.hashSymmetricDifference(_103[0], _103[1]).next()), 221, (v4: Nibble.Nibble): rt.u8 => { + return rt.hashContains(_103[0], v4) !== rt.hashContains(_103[1], v4) ? 1 : 0; + })); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_103[0], _103[1]) ? 1 : 0, rt.hashIsSuperset(_103[0], _103[1]) ? 1 : 0, rt.hashIsDisjoint(_103[0], _103[1]) ? 1 : 0))); + const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashUnion(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashIntersection(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashDifference(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashSymmetricDifference(_103[0], _103[1]))]); + while (true) { + const _159: rt.HashSet | rt.Done = iter4.next(); + if (_159 === rt.DONE) { + break; + } + putSorted$Nibble(rt.iterToArray(rt.hashKeys(_159)), put, out); + } + } +} + +export function setOpsOf$Option_u8(left: rt.ByteSlice, right: rt.ByteSlice, make: (a0: rt.u8) => rt.u8 | undefined, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const _7: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_2: rt.u8): rt.u8 | undefined => { + return make(_2); + }); + const a: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, _7, true); + const _12: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_22: rt.u8): rt.u8 | undefined => { + return make(_22); + }); + const b: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, _12, true); + const iter: rt.Iter<[rt.BTreeSet, rt.BTreeSet]> = rt.iterSlice([[a, b] as [rt.BTreeSet, rt.BTreeSet], [b, a] as [rt.BTreeSet, rt.BTreeSet]]); + while (true) { + const _25: [rt.BTreeSet, rt.BTreeSet] | rt.Done = iter.next(); + if (_25 === rt.DONE) { + break; + } + putAll$Option_u8_Union_Option_u8(rt.btreeUnion(_25[0], _25[1]), put, out); + putAll$Option_u8_Intersection_Option_u8(rt.btreeIntersection(_25[0], _25[1]), put, out); + putAll$Option_u8_Difference_Option_u8(rt.btreeDifference(_25[0], _25[1]), put, out); + putAll$Option_u8_SymmetricDifference_Option_u8(rt.btreeSymmetricDifference(_25[0], _25[1]), put, out); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.btreeUnion(_25[0], _25[1]).next(), rt.None), 221, put)); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.btreeIntersection(_25[0], _25[1]).next(), rt.None), 221, put)); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.btreeDifference(_25[0], _25[1]).next(), rt.None), 221, put)); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.btreeSymmetricDifference(_25[0], _25[1]).next(), rt.None), 221, put)); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.btreeIsSubset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsSuperset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsDisjoint(_25[0], _25[1]) ? 1 : 0))); + const iter2: rt.Iter> = rt.iterSlice([rt.btreeFromSorted(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, rt.btreeUnion(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, rt.btreeIntersection(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, rt.btreeDifference(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, rt.btreeSymmetricDifference(_25[0], _25[1]))]); + while (true) { + const _73: rt.BTreeSet | rt.Done = iter2.next(); + if (_73 === rt.DONE) { + break; + } + const built: rt.BTreeSet = _73; + putAll$Option_u8_Iter_Option_u8(rt.btreeKeys(built), put, out); + putAll$Option_u8_Rev_Iter_Option_u8(rt.iterRev(rt.btreeKeys(built)), put, out); + } + } + const _85: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): rt.u8 | undefined => { + return make(_23); + }); + const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, _85); + const _90: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): rt.u8 | undefined => { + return make(_24); + }); + const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, _90); + const iter3: rt.Iter<[rt.HashSet, rt.HashSet]> = rt.iterSlice([[a2, b2] as [rt.HashSet, rt.HashSet], [b2, a2] as [rt.HashSet, rt.HashSet]]); + while (true) { + const _103: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); + if (_103 === rt.DONE) { + break; + } + putSorted$Option_u8(rt.iterToArray(rt.hashUnion(_103[0], _103[1])), put, out); + putSorted$Option_u8(rt.iterToArray(rt.hashIntersection(_103[0], _103[1])), put, out); + putSorted$Option_u8(rt.iterToArray(rt.hashDifference(_103[0], _103[1])), put, out); + putSorted$Option_u8(rt.iterToArray(rt.hashSymmetricDifference(_103[0], _103[1])), put, out); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashUnion(_103[0], _103[1]).next(), rt.None), 221, (v: rt.u8 | undefined): rt.u8 => { + let _3!: boolean; + if (!rt.hashContains(_103[0], v)) { + _3 = rt.hashContains(_103[1], v); + } else { + _3 = true; + } + return _3 ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashIntersection(_103[0], _103[1]).next(), rt.None), 221, (v2: rt.u8 | undefined): rt.u8 => { + let _32!: boolean; + if (!rt.hashContains(_103[0], v2)) { + _32 = false; + } else { + _32 = rt.hashContains(_103[1], v2); + } + return _32 ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashDifference(_103[0], _103[1]).next(), rt.None), 221, (v3: rt.u8 | undefined): rt.u8 => { + return !rt.hashContains(_103[1], v3) ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashSymmetricDifference(_103[0], _103[1]).next(), rt.None), 221, (v4: rt.u8 | undefined): rt.u8 => { + return rt.hashContains(_103[0], v4) !== rt.hashContains(_103[1], v4) ? 1 : 0; + })); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_103[0], _103[1]) ? 1 : 0, rt.hashIsSuperset(_103[0], _103[1]) ? 1 : 0, rt.hashIsDisjoint(_103[0], _103[1]) ? 1 : 0))); + const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashUnion(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashIntersection(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashDifference(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashSymmetricDifference(_103[0], _103[1]))]); + while (true) { + const _159: rt.HashSet | rt.Done = iter4.next(); + if (_159 === rt.DONE) { + break; + } + putSorted$Option_u8(rt.iterToArray(rt.hashKeys(_159)), put, out); + } + } +} + +export function setOpsOf$u8(left: rt.ByteSlice, right: rt.ByteSlice, make: (a0: rt.u8) => rt.u8, put: (a0: rt.u8) => rt.u8, out: rt.ByteVec): void { + const _7: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_2: rt.u8): rt.u8 => { + return make(_2); + }); + const a: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmp) as rt.BTreeSet, _7, true); + const _12: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_22: rt.u8): rt.u8 => { + return make(_22); + }); + const b: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmp) as rt.BTreeSet, _12, true); + const iter: rt.Iter<[rt.BTreeSet, rt.BTreeSet]> = rt.iterSlice([[a, b] as [rt.BTreeSet, rt.BTreeSet], [b, a] as [rt.BTreeSet, rt.BTreeSet]]); + while (true) { + const _25: [rt.BTreeSet, rt.BTreeSet] | rt.Done = iter.next(); + if (_25 === rt.DONE) { + break; + } + putAll$u8_Union_u8(rt.btreeUnion(_25[0], _25[1]), put, out); + putAll$u8_Intersection_u8(rt.btreeIntersection(_25[0], _25[1]), put, out); + putAll$u8_Difference_u8(rt.btreeDifference(_25[0], _25[1]), put, out); + putAll$u8_SymmetricDifference_u8(rt.btreeSymmetricDifference(_25[0], _25[1]), put, out); + rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.btreeUnion(_25[0], _25[1]).next()), 221, put)); + rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.btreeIntersection(_25[0], _25[1]).next()), 221, put)); + rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.btreeDifference(_25[0], _25[1]).next()), 221, put)); + rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.btreeSymmetricDifference(_25[0], _25[1]).next()), 221, put)); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.btreeIsSubset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsSuperset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsDisjoint(_25[0], _25[1]) ? 1 : 0))); + const iter2: rt.Iter> = rt.iterSlice([rt.btreeFromSorted(rt.btreeNew(rt.cmp) as rt.BTreeSet, rt.btreeUnion(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmp) as rt.BTreeSet, rt.btreeIntersection(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmp) as rt.BTreeSet, rt.btreeDifference(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmp) as rt.BTreeSet, rt.btreeSymmetricDifference(_25[0], _25[1]))]); + while (true) { + const _73: rt.BTreeSet | rt.Done = iter2.next(); + if (_73 === rt.DONE) { + break; + } + const built: rt.BTreeSet = _73; + putAll$u8_Iter_u8(rt.btreeKeys(built), put, out); + putAll$u8_Rev_Iter_u8(rt.iterRev(rt.btreeKeys(built)), put, out); + } + } + const _85: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): rt.u8 => { + return make(_23); + }); + const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew() as rt.HashSet, _85); + const _90: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): rt.u8 => { + return make(_24); + }); + const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew() as rt.HashSet, _90); + const iter3: rt.Iter<[rt.HashSet, rt.HashSet]> = rt.iterSlice([[a2, b2] as [rt.HashSet, rt.HashSet], [b2, a2] as [rt.HashSet, rt.HashSet]]); + while (true) { + const _103: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); + if (_103 === rt.DONE) { + break; + } + putSorted$u8(rt.iterToArray(rt.hashUnion(_103[0], _103[1])), put, out); + putSorted$u8(rt.iterToArray(rt.hashIntersection(_103[0], _103[1])), put, out); + putSorted$u8(rt.iterToArray(rt.hashDifference(_103[0], _103[1])), put, out); + putSorted$u8(rt.iterToArray(rt.hashSymmetricDifference(_103[0], _103[1])), put, out); + rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.hashUnion(_103[0], _103[1]).next()), 221, (v: rt.u8): rt.u8 => { + let _3!: boolean; + if (!rt.hashContains(_103[0], v)) { + _3 = rt.hashContains(_103[1], v); + } else { + _3 = true; + } + return _3 ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.hashIntersection(_103[0], _103[1]).next()), 221, (v2: rt.u8): rt.u8 => { + let _32!: boolean; + if (!rt.hashContains(_103[0], v2)) { + _32 = false; + } else { + _32 = rt.hashContains(_103[1], v2); + } + return _32 ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.hashDifference(_103[0], _103[1]).next()), 221, (v3: rt.u8): rt.u8 => { + return !rt.hashContains(_103[1], v3) ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.hashSymmetricDifference(_103[0], _103[1]).next()), 221, (v4: rt.u8): rt.u8 => { + return rt.hashContains(_103[0], v4) !== rt.hashContains(_103[1], v4) ? 1 : 0; + })); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_103[0], _103[1]) ? 1 : 0, rt.hashIsSuperset(_103[0], _103[1]) ? 1 : 0, rt.hashIsDisjoint(_103[0], _103[1]) ? 1 : 0))); + const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew() as rt.HashSet, rt.hashUnion(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew() as rt.HashSet, rt.hashIntersection(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew() as rt.HashSet, rt.hashDifference(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew() as rt.HashSet, rt.hashSymmetricDifference(_103[0], _103[1]))]); + while (true) { + const _159: rt.HashSet | rt.Done = iter4.next(); + if (_159 === rt.DONE) { + break; + } + putSorted$u8(rt.iterToArray(rt.hashKeys(_159)), put, out); + } + } +} + +export function setOpsOf$u8s(left: rt.ByteSlice, right: rt.ByteSlice, make: (a0: rt.u8) => Uint8Array, put: (a0: rt.ByteSlice) => rt.u8, out: rt.ByteVec): void { + const _7: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_2: rt.u8): Uint8Array => { + return make(_2); + }); + const a: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, _7, true); + const _12: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_22: rt.u8): Uint8Array => { + return make(_22); + }); + const b: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, _12, true); + const iter: rt.Iter<[rt.BTreeSet, rt.BTreeSet]> = rt.iterSlice([[a, b] as [rt.BTreeSet, rt.BTreeSet], [b, a] as [rt.BTreeSet, rt.BTreeSet]]); + while (true) { + const _25: [rt.BTreeSet, rt.BTreeSet] | rt.Done = iter.next(); + if (_25 === rt.DONE) { + break; + } + putAll$u8s_Union_u8s(rt.iterMap(rt.btreeUnion(_25[0], _25[1]), rt.byteSliceFrom), put, out); + putAll$u8s_Intersection_u8s(rt.iterMap(rt.btreeIntersection(_25[0], _25[1]), rt.byteSliceFrom), put, out); + putAll$u8s_Difference_u8s(rt.iterMap(rt.btreeDifference(_25[0], _25[1]), rt.byteSliceFrom), put, out); + putAll$u8s_SymmetricDifference_u8s(rt.iterMap(rt.btreeSymmetricDifference(_25[0], _25[1]), rt.byteSliceFrom), put, out); + rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.btreeUnion(_25[0], _25[1]), rt.byteSliceFrom).next()), 221, put)); + rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.btreeIntersection(_25[0], _25[1]), rt.byteSliceFrom).next()), 221, put)); + rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.btreeDifference(_25[0], _25[1]), rt.byteSliceFrom).next()), 221, put)); + rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.btreeSymmetricDifference(_25[0], _25[1]), rt.byteSliceFrom).next()), 221, put)); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.btreeIsSubset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsSuperset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsDisjoint(_25[0], _25[1]) ? 1 : 0))); + const iter2: rt.Iter> = rt.iterSlice([rt.btreeFromSorted(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, rt.iterMap(rt.btreeUnion(_25[0], _25[1]), copy$u8s)), rt.btreeFromSorted(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, rt.iterMap(rt.btreeIntersection(_25[0], _25[1]), copy$u8s)), rt.btreeFromSorted(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, rt.iterMap(rt.btreeDifference(_25[0], _25[1]), copy$u8s)), rt.btreeFromSorted(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, rt.iterMap(rt.btreeSymmetricDifference(_25[0], _25[1]), copy$u8s))]); + while (true) { + const _73: rt.BTreeSet | rt.Done = iter2.next(); + if (_73 === rt.DONE) { + break; + } + const built: rt.BTreeSet = _73; + putAll$u8s_Iter_u8s(rt.iterMap(rt.btreeKeys(built), rt.byteSliceFrom), put, out); + putAll$u8s_Rev_Iter_u8s(rt.iterRev(rt.iterMap(rt.btreeKeys(built), rt.byteSliceFrom)), put, out); + } + } + const _85: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): Uint8Array => { + return make(_23); + }); + const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, _85); + const _90: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): Uint8Array => { + return make(_24); + }); + const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, _90); + const iter3: rt.Iter<[rt.HashSet, rt.HashSet]> = rt.iterSlice([[a2, b2] as [rt.HashSet, rt.HashSet], [b2, a2] as [rt.HashSet, rt.HashSet]]); + while (true) { + const _103: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); + if (_103 === rt.DONE) { + break; + } + putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashUnion(_103[0], _103[1]), rt.byteSliceFrom)), put, out); + putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashIntersection(_103[0], _103[1]), rt.byteSliceFrom)), put, out); + putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashDifference(_103[0], _103[1]), rt.byteSliceFrom)), put, out); + putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashSymmetricDifference(_103[0], _103[1]), rt.byteSliceFrom)), put, out); + rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.hashUnion(_103[0], _103[1]), rt.byteSliceFrom).next()), 221, (v: rt.ByteSlice): rt.u8 => { + let _3!: boolean; + if (!rt.hashContains(_103[0], rt.byteSliceView(v))) { + _3 = rt.hashContains(_103[1], rt.byteSliceView(v)); + } else { + _3 = true; + } + return _3 ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.hashIntersection(_103[0], _103[1]), rt.byteSliceFrom).next()), 221, (v2: rt.ByteSlice): rt.u8 => { + let _32!: boolean; + if (!rt.hashContains(_103[0], rt.byteSliceView(v2))) { + _32 = false; + } else { + _32 = rt.hashContains(_103[1], rt.byteSliceView(v2)); + } + return _32 ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.hashDifference(_103[0], _103[1]), rt.byteSliceFrom).next()), 221, (v3: rt.ByteSlice): rt.u8 => { + return !rt.hashContains(_103[1], rt.byteSliceView(v3)) ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.hashSymmetricDifference(_103[0], _103[1]), rt.byteSliceFrom).next()), 221, (v4: rt.ByteSlice): rt.u8 => { + return rt.hashContains(_103[0], rt.byteSliceView(v4)) !== rt.hashContains(_103[1], rt.byteSliceView(v4)) ? 1 : 0; + })); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_103[0], _103[1]) ? 1 : 0, rt.hashIsSuperset(_103[0], _103[1]) ? 1 : 0, rt.hashIsDisjoint(_103[0], _103[1]) ? 1 : 0))); + const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, rt.iterMap(rt.hashUnion(_103[0], _103[1]), copy$u8s)), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, rt.iterMap(rt.hashIntersection(_103[0], _103[1]), copy$u8s)), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, rt.iterMap(rt.hashDifference(_103[0], _103[1]), copy$u8s)), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, rt.iterMap(rt.hashSymmetricDifference(_103[0], _103[1]), copy$u8s))]); + while (true) { + const _159: rt.HashSet | rt.Done = iter4.next(); + if (_159 === rt.DONE) { + break; + } + putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashKeys(_159), rt.byteSliceFrom)), put, out); + } + } +} + +/** How many `items` there are, then each. */ +export function putAll$Nibble_Difference_Nibble(items: rt.Iter, put: (a0: Nibble.Nibble) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: Nibble.Nibble | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Nibble_Intersection_Nibble(items: rt.Iter, put: (a0: Nibble.Nibble) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: Nibble.Nibble | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Nibble_IntoIter_Nibble(items: rt.Iter, put: (a0: Nibble.Nibble) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: Nibble.Nibble | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Nibble_Iter_Nibble(items: rt.Iter, put: (a0: Nibble.Nibble) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: Nibble.Nibble | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Nibble_Rev_Iter_Nibble(items: rt.Iter, put: (a0: Nibble.Nibble) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: Nibble.Nibble | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Nibble_SymmetricDifference_Nibble(items: rt.Iter, put: (a0: Nibble.Nibble) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: Nibble.Nibble | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Nibble_Union_Nibble(items: rt.Iter, put: (a0: Nibble.Nibble) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: Nibble.Nibble | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Option_u8_Difference_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Option_u8_Intersection_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Option_u8_IntoIter_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Option_u8_Iter_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Option_u8_Rev_Iter_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Option_u8_SymmetricDifference_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Option_u8_Union_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8_Difference_u8(items: rt.Iter, put: (a0: rt.u8) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8_Intersection_u8(items: rt.Iter, put: (a0: rt.u8) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8_IntoIter_u8(items: rt.Iter, put: (a0: rt.u8) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8_Iter_u8(items: rt.Iter, put: (a0: rt.u8) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8_Rev_Iter_u8(items: rt.Iter, put: (a0: rt.u8) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8_SymmetricDifference_u8(items: rt.Iter, put: (a0: rt.u8) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8_Union_u8(items: rt.Iter, put: (a0: rt.u8) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8s_Difference_u8s(items: rt.Iter, put: (a0: rt.ByteSlice) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.ByteSlice | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8s_Intersection_u8s(items: rt.Iter, put: (a0: rt.ByteSlice) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.ByteSlice | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8s_IntoIter_u8s(items: rt.Iter, put: (a0: rt.ByteSlice) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.ByteSlice | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8s_Iter_u8s(items: rt.Iter, put: (a0: rt.ByteSlice) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.ByteSlice | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8s_Rev_Iter_u8s(items: rt.Iter, put: (a0: rt.ByteSlice) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.ByteSlice | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8s_SymmetricDifference_u8s(items: rt.Iter, put: (a0: rt.ByteSlice) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.ByteSlice | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$u8s_Union_u8s(items: rt.Iter, put: (a0: rt.ByteSlice) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.ByteSlice | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** [`put_all`] of `items` in order. */ +export function putSorted$Nibble(items: Nibble.Nibble[], put: (a0: Nibble.Nibble) => rt.u8, out: rt.ByteVec): void { + rt.sliceSort(items, rt.cmpLt(Nibble.partialCmp$PartialOrd)); + putAll$Nibble_IntoIter_Nibble(rt.iterSlice(items), put, out); +} + +/** [`put_all`] of `items` in order. */ +export function putSorted$Option_u8(items: Array, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + rt.sliceSort(items, rt.cmpLt(rt.cmpOption(rt.cmp))); + putAll$Option_u8_IntoIter_Option_u8(rt.iterSlice(items), put, out); +} + +/** [`put_all`] of `items` in order. */ +export function putSorted$u8(items: rt.u8[], put: (a0: rt.u8) => rt.u8, out: rt.ByteVec): void { + rt.sliceSort(items, rt.lt); + putAll$u8_IntoIter_u8(rt.iterSlice(items), put, out); +} + +/** [`put_all`] of `items` in order. */ +export function putSorted$u8s(items: rt.ByteSlice[], put: (a0: rt.ByteSlice) => rt.u8, out: rt.ByteVec): void { + rt.sliceSort(items, rt.cmpLt(rt.cmpBytes)); + putAll$u8s_IntoIter_u8s(rt.iterSlice(items), put, out); +} + //# sourceMappingURL=collections.ts.map diff --git a/ts/fixtures/lang/expected/harness.ts b/ts/fixtures/lang/expected/harness.ts index 76ee08217..7db844846 100644 --- a/ts/fixtures/lang/expected/harness.ts +++ b/ts/fixtures/lang/expected/harness.ts @@ -9,7 +9,7 @@ import { captures } from "./captures.ts"; import { cells } from "./cells.ts"; import { chars } from "./chars.ts"; import { chunks } from "./chunks.ts"; -import { hashMaps, sets, btreeMaps, deques, vecs, stores, optionals } from "./collections.ts"; +import { hashMaps, sets, btreeMaps, deques, vecs, stores, optionals, setOps } from "./collections.ts"; import { combinators } from "./combinators.ts"; import { arcs, clonedArcs, cyclicArcs, uniqueArcs, clonedRcs, cyclicRcs, rcs, uniqueRcs, copies } from "./counts.ts"; import { cows } from "./cows.ts"; @@ -185,7 +185,7 @@ export function cases(): [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) uninhabited(data67, out68); }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["keys::lent_keys", lentKeys] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["keys::lent_values", lentValues] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["singles::singles", singles] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["singles::formats", singles_formats] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["singles::parses", singles_parses] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["iters::peeked_others", (_2168: rt.u8, data68: rt.ByteSlice, out69: rt.ByteVec): void => { peekedOthers(data68, out69); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void]]; + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["collections::set_ops", setOps] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void]]; } /** Run one case. */ diff --git a/ts/fixtures/lang/src/collections.rs b/ts/fixtures/lang/src/collections.rs index 06356fa5b..14737e0f3 100644 --- a/ts/fixtures/lang/src/collections.rs +++ b/ts/fixtures/lang/src/collections.rs @@ -6,6 +6,7 @@ use std::cmp::Ordering; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque, btree_map, hash_map}; use std::hash::{DefaultHasher, Hash, Hasher}; +use std::ops::Bound; use crate::generics::Wrap; use crate::iters::Bumped; @@ -990,3 +991,120 @@ pub fn optionals(kind: u8, data: &[u8], out: &mut Vec) { } } } + +/// `union`, `intersection`, `difference`, and `symmetric_difference` of two sets each way, +/// by method and by operator, and whether one is a subset, superset, or disjoint from the +/// other: of sets that overlap, are equal, are empty, are disjoint, or are one key against +/// many, where std's B-tree searches the larger rather than merging. A B-tree's yield in +/// its order, and the sets its operators build are read from both ends; a hash set's yield +/// in the runtime's, so what each yields is sorted first. The `Nibble` an op yields shows +/// which set's key of two equal ones std's picks. +pub fn set_ops(kind: u8, data: &[u8], out: &mut Vec) { + let (mut left, mut right) = data.split_at(data.len() / 2); + let (evens, odds): (Vec, Vec); + match kind / 4 % 6 { + 0 => {} + 1 => right = left, + 2 => left = &[], + 3 => (left, right) = data.split_at(data.len().min(1)), + // Each map below keeps a byte's parity, so evens and odds never meet. + 4 => { + evens = left.iter().map(|b| b & !1).collect(); + odds = right.iter().map(|b| b | 1).collect(); + (left, right) = (&evens, &odds); + } + // What an operator builds has its root even with no keys, so its range checks its + // bounds, and panics. + _ => { + let all: BTreeSet = data.iter().copied().collect(); + let none = &all - &all; + let k = data.first().copied().unwrap_or(0); + out.push(none.range((Bound::Excluded(k), Bound::Excluded(k))).count() as u8); + return; + } + } + match kind % 4 { + 0 => set_ops_of(left, right, |b| b % 32, |v| *v, out), + 1 => set_ops_of(left, right, |b| [b % 4, b / 4 % 4], |k| k[0] << 4 | k[1], out), + 2 => set_ops_of( + left, + right, + |b| (b % 32 != 0).then_some(b % 32), + |v| v.unwrap_or(0xee), + out, + ), + _ => set_ops_of(left, right, Nibble, |n| n.0, out), + } +} + +fn set_ops_of( + left: &[u8], + right: &[u8], + make: fn(u8) -> T, + put: fn(&T) -> u8, + out: &mut Vec, +) { + let a: BTreeSet = left.iter().map(|&b| make(b)).collect(); + let b: BTreeSet = right.iter().map(|&b| make(b)).collect(); + for (x, y) in [(&a, &b), (&b, &a)] { + put_all(x.union(y), put, out); + put_all(x.intersection(y), put, out); + put_all(x.difference(y), put, out); + put_all(x.symmetric_difference(y), put, out); + // Only the first, where the merge stops. + out.push(x.union(y).next().map_or(0xdd, put)); + out.push(x.intersection(y).next().map_or(0xdd, put)); + out.push(x.difference(y).next().map_or(0xdd, put)); + out.push(x.symmetric_difference(y).next().map_or(0xdd, put)); + out.extend([x.is_subset(y) as u8, x.is_superset(y) as u8, x.is_disjoint(y) as u8]); + for built in [x | y, x & y, x - y, x ^ y] { + put_all(built.iter(), put, out); + put_all(built.iter().rev(), put, out); + } + } + let a: HashSet = left.iter().map(|&b| make(b)).collect(); + let b: HashSet = right.iter().map(|&b| make(b)).collect(); + for (x, y) in [(&a, &b), (&b, &a)] { + put_sorted(x.union(y).collect(), put, out); + put_sorted(x.intersection(y).collect(), put, out); + put_sorted(x.difference(y).collect(), put, out); + put_sorted(x.symmetric_difference(y).collect(), put, out); + // Only the first, which is the runtime's pick, so only where it belongs is written. + out.push( + x.union(y) + .next() + .map_or(0xdd, |v| u8::from(x.contains(v) || y.contains(v))), + ); + out.push( + x.intersection(y) + .next() + .map_or(0xdd, |v| u8::from(x.contains(v) && y.contains(v))), + ); + out.push(x.difference(y).next().map_or(0xdd, |v| u8::from(!y.contains(v)))); + out.push( + x.symmetric_difference(y) + .next() + .map_or(0xdd, |v| u8::from(x.contains(v) != y.contains(v))), + ); + out.extend([x.is_subset(y) as u8, x.is_superset(y) as u8, x.is_disjoint(y) as u8]); + for built in [x | y, x & y, x - y, x ^ y] { + put_sorted(built.iter().collect(), put, out); + } + } +} + +/// How many `items` there are, then each. +fn put_all<'a, T: 'a>(items: impl Iterator, put: fn(&T) -> u8, out: &mut Vec) { + let at = out.len(); + out.push(0); + for item in items { + out.push(put(item)); + } + out[at] = (out.len() - at - 1) as u8; +} + +/// [`put_all`] of `items` in order. +fn put_sorted(mut items: Vec<&T>, put: fn(&T) -> u8, out: &mut Vec) { + items.sort(); + put_all(items.into_iter(), put, out); +} diff --git a/ts/fixtures/lang/src/harness.rs b/ts/fixtures/lang/src/harness.rs index 855f7b144..d5bb97819 100644 --- a/ts/fixtures/lang/src/harness.rs +++ b/ts/fixtures/lang/src/harness.rs @@ -161,6 +161,7 @@ fn cases() -> Vec<(&'static str, Case)> { ("singles::formats", singles::formats), ("singles::parses", singles::parses), ("iters::peeked_others", |_, data, out| iters::peeked_others(data, out)), + ("collections::set_ops", collections::set_ops), ] } diff --git a/ts/runtime/rt/collections.ts b/ts/runtime/rt/collections.ts index 29dfeb4a7..3eb5b9bbb 100644 --- a/ts/runtime/rt/collections.ts +++ b/ts/runtime/rt/collections.ts @@ -17,7 +17,7 @@ import { ByteSlice, type ByteVec, type None, type Place, panic, type RangeBound, rangeCheck } from "../rt.ts"; import type { Hashing } from "./hash.ts"; import { type Limbs, lt } from "./int.ts"; -import { DONE, type Done, Iter, iterMap, iterSlice, type RangeInclusive, rangeInclusiveEndBound, rangeInclusiveStartBound, type Take } from "./iter.ts"; +import { DONE, type Done, Iter, iterChain, iterEmpty, iterFilter, iterMap, iterOnce, iterSlice, type RangeInclusive, rangeInclusiveEndBound, rangeInclusiveStartBound, type Take } from "./iter.ts"; import { type Arc, drop as dispose, dropAll, dropRange } from "./task.ts"; // Ordering @@ -768,6 +768,50 @@ export function hashClone(m: HashMap, key: (k: K) => K = itself, val return out; } +// Set operations of hash sets, as std's: each walks one set's keys in the runtime's +// order, which picks which set's key of two equal ones it yields. + +/** `HashSet::union`: each key of the larger, `a` of two as large, then each of the other's that it lacks. */ +export function hashUnion(a: HashSet, b: HashSet): Iter { + const [large, small] = hashLen(a) >= hashLen(b) ? [a, b] : [b, a]; + return iterChain(hashKeys(large), hashDifference(small, large)); +} + +/** `HashSet::intersection`: each key of the smaller, `a` of two as large, that the other holds. */ +export function hashIntersection(a: HashSet, b: HashSet): Iter { + const [small, large] = hashLen(a) <= hashLen(b) ? [a, b] : [b, a]; + return iterFilter(hashKeys(small), (key) => hashContains(large, key)); +} + +/** `HashSet::difference`: each key of `a` that `b` lacks. */ +export function hashDifference(a: HashSet, b: HashSet): Iter { + return iterFilter(hashKeys(a), (key) => !hashContains(b, key)); +} + +/** `HashSet::symmetric_difference`: `a`'s difference from `b`, then `b`'s from `a`. */ +export function hashSymmetricDifference(a: HashSet, b: HashSet): Iter { + return iterChain(hashDifference(a, b), hashDifference(b, a)); +} + +/** `HashSet::is_subset`: whether `b` holds each key of `a`. */ +export function hashIsSubset(a: HashSet, b: HashSet): boolean { + if (hashLen(a) > hashLen(b)) return false; + for (const key of hashKeys(a)) if (!hashContains(b, key)) return false; + return true; +} + +/** `HashSet::is_superset`: whether `a` holds each key of `b`. */ +export function hashIsSuperset(a: HashSet, b: HashSet): boolean { + return hashIsSubset(b, a); +} + +/** `HashSet::is_disjoint`: whether the larger lacks each key of the smaller, `a` of two as large. */ +export function hashIsDisjoint(a: HashSet, b: HashSet): boolean { + const [small, large] = hashLen(a) <= hashLen(b) ? [a, b] : [b, a]; + for (const key of hashKeys(small)) if (hashContains(large, key)) return false; + return true; +} + // BTreeMap and BTreeSet /** @@ -1562,6 +1606,227 @@ export function btreeClone(m: BTreeMap, key: (k: K) => K = itself, v return out; } +// Set operations of B-trees, as std's: each merges both sets' keys in order, or of sets +// whose sizes differ by `TIPPING` times or more, looks up each of the smaller's in the +// larger, which picks which set's key of two equal ones it yields. + +/** std's `ITER_PERFORMANCE_TIPPING_SIZE_DIFF`. */ +const TIPPING = 16; + +/** The first and last keys of `m`, which holds some. */ +function ends(m: BTreeSet): [K, K] { + return [btreeFirstKey(m) as K, btreeFirstKey(m, true) as K]; +} + +/** + * std's `MergeIterInner`: the keys of `a` and `b` in order, a step at a time, holding back + * the greater of two that differ. + */ +abstract class Merge extends Iter { + private readonly a: Iter; + private readonly b: Iter; + private readonly c: (a: K, b: K) => Ordering; + /** The key held back, and whether it is `a`'s. */ + private held: K | Done = DONE; + private heldA = false; + + constructor(a: BTreeSet, b: BTreeSet) { + super(); + this.a = btreeKeys(a); + this.b = btreeKeys(b); + this.c = a.c; + } + + /** The next key of each, or `DONE` for one that ended or is held back. */ + protected nexts(): [K | Done, K | Done] { + const held = this.held; + this.held = DONE; + const x = held !== DONE && this.heldA ? held : this.a.next(); + const y = held !== DONE && !this.heldA ? held : this.b.next(); + if (x === DONE || y === DONE) return [x, y]; + const order = this.c(x, y); + if (order === 0) return [x, y]; + this.held = order < 0 ? y : x; + this.heldA = order > 0; + return order < 0 ? [x, DONE] : [DONE, y]; + } +} + +class Union extends Merge { + next(): K | Done { + const [x, y] = this.nexts(); + return x !== DONE ? x : y; + } +} + +class SymmetricDifference extends Merge { + next(): K | Done { + for (;;) { + const [x, y] = this.nexts(); + if (x === DONE || y === DONE) return x !== DONE ? x : y; + } + } +} + +/** `BTreeSet::union`: each key of either in order, `a`'s of two equal ones. */ +export function btreeUnion(a: BTreeSet, b: BTreeSet): Iter { + return new Union(a, b); +} + +/** `BTreeSet::symmetric_difference`: each key of one that the other lacks, in order. */ +export function btreeSymmetricDifference(a: BTreeSet, b: BTreeSet): Iter { + return new SymmetricDifference(a, b); +} + +/** A difference that merges: each key of `a` that `b`, peeked a key ahead, lacks. */ +class Difference extends Iter { + private readonly a: Iter; + private readonly b: Iter; + private readonly c: (a: K, b: K) => Ordering; + /** `b`'s next key, or `undefined` until it is peeked. */ + private peeked: K | Done | undefined = undefined; + + constructor(a: Iter, b: Iter, c: (a: K, b: K) => Ordering) { + super(); + this.a = a; + this.b = b; + this.c = c; + } + + next(): K | Done { + let x = this.a.next(); + if (x === DONE) return DONE; + for (;;) { + if (this.peeked === undefined) this.peeked = this.b.next(); + const order = this.peeked === DONE ? -1 : this.c(x, this.peeked); + if (order < 0) return x; + if (order === 0) { + x = this.a.next(); + if (x === DONE) return DONE; + } + this.peeked = undefined; + } + } +} + +/** `BTreeSet::difference`: each key of `a` that `b` lacks, in order. */ +export function btreeDifference(a: BTreeSet, b: BTreeSet): Iter { + const keys = btreeKeys(a); + if (a.n === 0 || b.n === 0) return keys; + const [aMin, aMax] = ends(a); + const [bMin, bMax] = ends(b); + const low = a.c(aMin, bMax); + const high = a.c(aMax, bMin); + if (low > 0 || high < 0) return keys; + if (low === 0) keys.next(); + else if (high === 0) keys.nextBack(); + else if (a.n <= Math.floor(b.n / TIPPING)) return iterFilter(keys, (key) => !btreeContains(b, key)); + else return new Difference(keys, btreeKeys(b), a.c); + return keys; +} + +/** An intersection that merges: each key of `a` that `b` holds. */ +class Intersection extends Iter { + private readonly a: Iter; + private readonly b: Iter; + private readonly c: (a: K, b: K) => Ordering; + + constructor(a: BTreeSet, b: BTreeSet) { + super(); + this.a = btreeKeys(a); + this.b = btreeKeys(b); + this.c = a.c; + } + + next(): K | Done { + let x = this.a.next(); + if (x === DONE) return DONE; + let y = this.b.next(); + if (y === DONE) return DONE; + for (;;) { + const order = this.c(x, y); + if (order === 0) return x; + if (order < 0) x = this.a.next(); + else y = this.b.next(); + if (x === DONE || y === DONE) return DONE; + } + } +} + +/** + * `BTreeSet::intersection`: each key of both in order, `a`'s of two equal ones, unless + * `b` is the smaller by `TIPPING` times, which has its own looked up in `a`. + */ +export function btreeIntersection(a: BTreeSet, b: BTreeSet): Iter { + if (a.n === 0 || b.n === 0) return iterEmpty(); + const [aMin, aMax] = ends(a); + const [bMin, bMax] = ends(b); + const low = a.c(aMin, bMax); + const high = a.c(aMax, bMin); + if (low > 0 || high < 0) return iterEmpty(); + if (low === 0) return iterOnce(aMin); + if (high === 0) return iterOnce(aMax); + if (a.n <= Math.floor(b.n / TIPPING)) return iterFilter(btreeKeys(a), (key) => btreeContains(b, key)); + if (b.n <= Math.floor(a.n / TIPPING)) return iterFilter(btreeKeys(b), (key) => btreeContains(a, key)); + return new Intersection(a, b); +} + +/** `BTreeSet::is_subset`: whether `b` holds each key of `a`. */ +export function btreeIsSubset(a: BTreeSet, b: BTreeSet): boolean { + if (a.n > b.n) return false; + if (a.n === 0) return true; + if (b.n === 0) return false; + const [aMin, aMax] = ends(a); + const [bMin, bMax] = ends(b); + const keys = btreeKeys(a); + const low = a.c(aMin, bMin); + if (low < 0) return false; + if (low === 0) keys.next(); + const high = a.c(aMax, bMax); + if (high > 0) return false; + if (high === 0) keys.nextBack(); + if (keys.len() <= Math.floor(b.n / TIPPING)) { + for (const key of keys) if (!btreeContains(b, key)) return false; + return true; + } + // Each of `a`'s found by stepping through `b`'s between their ends, which `a`'s left lack. + const others = btreeKeys(b); + others.next(); + others.nextBack(); + for (const key of keys) { + let order: Ordering = 1; + for (let other = others.next(); other !== DONE; other = others.next()) { + order = a.c(other, key); + if (order >= 0) break; + } + if (order !== 0) return false; + } + return true; +} + +/** `BTreeSet::is_superset`: whether `a` holds each key of `b`. */ +export function btreeIsSuperset(a: BTreeSet, b: BTreeSet): boolean { + return btreeIsSubset(b, a); +} + +/** `BTreeSet::is_disjoint`: whether their intersection yields nothing. */ +export function btreeIsDisjoint(a: BTreeSet, b: BTreeSet): boolean { + return btreeIntersection(a, b).next() === DONE; +} + +/** What a set operator builds: `m`, an empty set, of `keys`, which are in order and distinct. */ +export function btreeFromSorted(m: BTreeSet, keys: Iter): BTreeSet { + const held = [...keys]; + build( + m, + held, + held.map(() => undefined), + ); + // std's bulk build makes the root even of no keys. + m.r = true; + return m; +} + // Entries /** diff --git a/ts/src/lower/collections.rs b/ts/src/lower/collections.rs index ac1671e84..d32fcec5f 100644 --- a/ts/src/lower/collections.rs +++ b/ts/src/lower/collections.rs @@ -39,7 +39,8 @@ pub fn call<'tcx>( | ("Clone", "clone", Some(std), Some(t)) | ("Index" | "IndexMut", "index" | "index_mut", Some(std), Some(t)) | ("Extend", "extend", Some(std), Some(t)) - | ("From", "from", Some(std), Some(t)) => (std, t.peel_refs()), + | ("From", "from", Some(std), Some(t)) + | ("BitOr" | "BitAnd" | "Sub" | "BitXor", _, Some(std), Some(t)) => (std, t.peel_refs()), // Comparing and hashing a key of a std type. ("Ord", "cmp", ..) | ("PartialOrd", "partial_cmp", ..) if let Some(t) = self_ty => { let t = peel(b, t); @@ -278,11 +279,16 @@ pub fn lends_call<'tcx>(t: &Translator<'_, 'tcx>, def_id: DefId, args: GenericAr if held.types().any(holds_bytes_ref) { return Some(false); } + let name = tcx.item_name(def_id); + let other_set = + set_op("", name.as_str()).is_some() || matches!(name.as_str(), "bitor" | "bitand" | "sub" | "bitxor"); let sig = t.sig(def_id, args); let taken = sig.inputs().iter().skip(1).all(|&input| match closure_sig(tcx, input) { Some((params, output)) => params.iter().all(|&p| lends(t, p).is_some()) && !holds_bytes_ref(output), // A key looked up or compared by a reference to its bytes, which the runtime reads in - // either form, or what holds none, nor yields any as `extend` takes what it stores. + // either form, the other set of a set operation, which it reads as it holds, or what + // holds none, nor yields any as `extend` takes what it stores. + None if other_set && input.peel_refs() == coll => true, None => { let yielded = super::iter::iter_of(t, input).and_then(|iter| t.iter_item(iter)); super::bytes_ref(input) @@ -633,6 +639,12 @@ fn hash<'tcx>( ) } (_, "entry") => Expr::rt("entry", values), + (_, name) if let Some(f) = set_op("hash", name) => Expr::rt(f, values), + ("BitOr" | "BitAnd" | "Sub" | "BitXor", _) => { + let keys = set_op_keys(b, coll, "hash", owner, values, span)?; + let target = hash_new(b, coll, span)?; + Expr::rt("hashExtendKeys", vec![target, keys]) + } (_, "reserve" | "shrink_to_fit") => { discard(values, out); Expr::undefined() @@ -660,6 +672,46 @@ fn hash<'tcx>( Some(e) } +/// The runtime's function of a set's operation or test `name`, of the runtime's `prefix` +/// for its type: `hashUnion` of a `HashSet`'s `union`. +fn set_op(prefix: &str, name: &str) -> Option { + let op = match name { + "union" => "Union", + "intersection" => "Intersection", + "difference" => "Difference", + "symmetric_difference" => "SymmetricDifference", + "is_subset" => "IsSubset", + "is_superset" => "IsSuperset", + "is_disjoint" => "IsDisjoint", + _ => return None, + }; + Some(format!("{prefix}{op}")) +} + +/// What the set operator of trait `owner` builds a set of type `coll` from, as std's: its +/// operation of the two sets in `values`, each key cloned. +fn set_op_keys<'tcx>( + b: &mut Body<'_, '_, 'tcx>, + coll: Ty<'tcx>, + prefix: &str, + owner: &str, + values: Vec, + span: Span, +) -> Option { + let name = match owner { + "BitOr" => "union", + "BitAnd" => "intersection", + "Sub" => "difference", + _ => "symmetric_difference", + }; + let keys = Expr::rt(set_op(prefix, name)?, values); + let clone = clone_fn(b, arg(coll, 0), span); + Some(match clone == Expr::undefined() { + true => keys, + false => Expr::rt("iterMap", vec![keys, clone]), + }) +} + /// `extend` of `target`, a hash collection of type `coll`, from `source`, an iterator of /// type `iter`, or `collect` into an empty one. fn hash_extend<'tcx>( @@ -921,6 +973,12 @@ fn btree<'tcx>( (_, "range" | "range_mut") => Expr::rt("btreeRange", values), (_, "entry") => Expr::rt("entry", values), (_, "split_off") => Expr::rt("btreeSplitOff", values), + (_, name) if let Some(f) = set_op("btree", name) => Expr::rt(f, values), + ("BitOr" | "BitAnd" | "Sub" | "BitXor", _) => { + let keys = set_op_keys(b, coll, "btree", owner, values, span)?; + let target = btree_new(b, coll, span); + Expr::rt("btreeFromSorted", vec![target, keys]) + } ("Index", "index") => Expr::rt("btreeIndex", values), ("Clone", "clone") => { let k = clone_fn(b, key, span); From b6778d046e65caf2eac0045f8c7f7f866aa9f268 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Fri, 30 Oct 2026 13:57:54 -0700 Subject: [PATCH 3/4] test(ts): regenerate the lang snapshot for set operations' hints Co-Authored-By: Claude Opus 5.5 --- ts/fixtures/lang/expected/collections.ts | 1255 +++++++++++++++++++--- ts/fixtures/lang/expected/harness.ts | 4 +- 2 files changed, 1116 insertions(+), 143 deletions(-) diff --git a/ts/fixtures/lang/expected/collections.ts b/ts/fixtures/lang/expected/collections.ts index d7dd4c3e0..bbac49837 100644 --- a/ts/fixtures/lang/expected/collections.ts +++ b/ts/fixtures/lang/expected/collections.ts @@ -12,7 +12,7 @@ import * as Pair from "./collections.Pair.ts"; import * as Rank from "./collections.Rank.ts"; import * as Tally from "./collections.Tally.ts"; import { thenSome$0d5am30 } from "./core/bool.ts"; -import { unwrapOr$1j4op5y, unwrapOr$0r2bmpr, map$0oc32h1, mapOr$0q0ymkh, mapOr$1xztl8h, mapOr$1to2ul4, mapOr$1ht002r, mapOr$099335t, mapOr$1surhce, mapOr$0mmpeqx, mapOr$1nlkf9b, mapOr$1w1gbwl, clone$14nprly, flatten$1nwzx42 } from "./core/option.ts"; +import { unwrapOr$1j4op5y, unwrapOr$0r2bmpr, map$0oc32h1, mapOr$0q0ymkh, mapOr$1xztl8h, mapOr$1to2ul4, mapOr$1ht002r, mapOr$099335t, mapOr$1surhce, mapOr$0mmpeqx, mapOr$1nlkf9b, mapOr$1w1gbwl, mapOr$02k4ito, clone$14nprly, flatten$1nwzx42 } from "./core/option.ts"; import * as Wrap from "./generics.Wrap.ts"; import * as Bumped from "./iters.Bumped.ts"; @@ -1589,7 +1589,7 @@ export function setOps(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { let left: rt.ByteSlice = new rt.ByteSlice(data.data, data.start, mid); let right: rt.ByteSlice = new rt.ByteSlice(data.data, data.start + mid, data.length - mid); b0: { - const _12: rt.u8 = rt.u8Rem(rt.u8Div(kind, 4), 6); + const _12: rt.u8 = rt.u8Rem(rt.u8Div(kind, 5), 6); if (_12 !== 0) { if (_12 === 1) { right = left; @@ -1605,46 +1605,52 @@ export function setOps(kind: rt.u8, data: rt.ByteSlice, out: rt.ByteVec): void { } else if (_12 === 4) { const _23: rt.ByteVec = rt.iterToByteVec(rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (b: rt.u8): rt.u8 => { return b & (~1 & 0xff); - })); + }), undefined, true); const _27: rt.ByteVec = rt.iterToByteVec(rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (b2: rt.u8): rt.u8 => { return b2 | 1; - })); + }), undefined, true); left = rt.byteVecSlice(_23); right = rt.byteVecSlice(_27); } else { const _39: rt.Iter = rt.iterSlice(rt.byteSliceView(data)); - const all: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmp) as rt.BTreeSet, _39, true); + const all: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmp) as rt.BTreeSet, _39, true, undefined, undefined, 1, true); const none: rt.BTreeSet = rt.btreeFromSorted(rt.btreeNew(rt.cmp) as rt.BTreeSet, rt.btreeDifference(all, all)); const k: rt.u8 = unwrapOr$0r2bmpr(rt.byteSliceFirst(data), 0); rt.byteVecPush(out, rt.iterCount(rt.btreeRangeKeys(none, [{ tag: "Excluded", _0: k } as rt.RangeBound, { tag: "Excluded", _0: k } as rt.RangeBound] as [rt.RangeBound, rt.RangeBound])) & 0xff); break b0; } } - const _55: rt.u8 = rt.u8Rem(kind, 4); + const _55: rt.u8 = rt.u8Rem(kind, 5); if (_55 === 0) { - setOpsOf$u8(left, right, (b5: rt.u8): rt.u8 => { - return rt.u8Rem(b5, 32); - }, (v2: rt.u8): rt.u8 => { - return v2; + setOpsOf$u8(left, right, (b6: rt.u8): rt.u8 => { + return rt.u8Rem(b6, 32); + }, (v3: rt.u8): rt.u8 => { + return v3; }, out); } else if (_55 === 1) { - setOpsOf$u8s(left, right, (b4: rt.u8): Uint8Array => { - return Uint8Array.of(rt.u8Rem(b4, 4), rt.u8Rem(rt.u8Div(b4, 4), 4)); + setOpsOf$u8s(left, right, (b5: rt.u8): Uint8Array => { + return Uint8Array.of(rt.u8Rem(b5, 4), rt.u8Rem(rt.u8Div(b5, 4), 4)); }, (k2: rt.ByteSlice): rt.u8 => { return ((k2.data[k2.start] << 4) & 0xff) | k2.data[k2.start + 1]; }, out); } else if (_55 === 2) { - setOpsOf$Option_u8(left, right, (b3: rt.u8): rt.u8 | undefined => { - return thenSome$0d5am30(rt.u8Rem(b3, 32) !== 0, rt.u8Rem(b3, 32)); - }, (v: rt.u8 | undefined): rt.u8 => { - return unwrapOr$0r2bmpr(v, 238); + setOpsOf$Option_u8(left, right, (b4: rt.u8): rt.u8 | undefined => { + return thenSome$0d5am30(rt.u8Rem(b4, 32) !== 0, rt.u8Rem(b4, 32)); + }, (v2: rt.u8 | undefined): rt.u8 => { + return unwrapOr$0r2bmpr(v2, 238); }, out); - } else { + } else if (_55 === 3) { setOpsOf$Nibble(left, right, (a0: rt.u8): Nibble.Nibble => { return { _0: a0 }; }, (n: Nibble.Nibble): rt.u8 => { return n._0; }, out); + } else { + setOpsOf$Reverse_Option_u8(left, right, (b3: rt.u8): rt.u8 | undefined => { + return thenSome$0d5am30(rt.u8Rem(b3, 32) !== 0, rt.u8Rem(b3, 32)); + }, (v: rt.u8 | undefined): rt.u8 => { + return unwrapOr$0r2bmpr(v, 238); + }, out); } } } @@ -1653,11 +1659,11 @@ export function setOpsOf$Nibble(left: rt.ByteSlice, right: rt.ByteSlice, make: ( const _7: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_2: rt.u8): Nibble.Nibble => { return make(_2); }); - const a: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, _7, true); + const a: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, _7, true, undefined, undefined, 1, true); const _12: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_22: rt.u8): Nibble.Nibble => { return make(_22); }); - const b: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, _12, true); + const b: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, _12, true, undefined, undefined, 1, true); const iter: rt.Iter<[rt.BTreeSet, rt.BTreeSet]> = rt.iterSlice([[a, b] as [rt.BTreeSet, rt.BTreeSet], [b, a] as [rt.BTreeSet, rt.BTreeSet]]); while (true) { const _25: [rt.BTreeSet, rt.BTreeSet] | rt.Done = iter.next(); @@ -1668,72 +1674,80 @@ export function setOpsOf$Nibble(left: rt.ByteSlice, right: rt.ByteSlice, make: ( putAll$Nibble_Intersection_Nibble(rt.btreeIntersection(_25[0], _25[1]), put, out); putAll$Nibble_Difference_Nibble(rt.btreeDifference(_25[0], _25[1]), put, out); putAll$Nibble_SymmetricDifference_Nibble(rt.btreeSymmetricDifference(_25[0], _25[1]), put, out); + putHints$Nibble_Union_Nibble(rt.btreeUnion(_25[0], _25[1]), 1, out); + putHints$Nibble_Intersection_Nibble(rt.btreeIntersection(_25[0], _25[1]), 1, out); + putHints$Nibble_Difference_Nibble(rt.btreeDifference(_25[0], _25[1]), 1, out); + putHints$Nibble_SymmetricDifference_Nibble(rt.btreeSymmetricDifference(_25[0], _25[1]), 1, out); rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.btreeUnion(_25[0], _25[1]).next()), 221, put)); rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.btreeIntersection(_25[0], _25[1]).next()), 221, put)); rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.btreeDifference(_25[0], _25[1]).next()), 221, put)); rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.btreeSymmetricDifference(_25[0], _25[1]).next()), 221, put)); - rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.btreeIsSubset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsSuperset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsDisjoint(_25[0], _25[1]) ? 1 : 0))); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.btreeIsSubset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsSuperset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsDisjoint(_25[0], _25[1]) ? 1 : 0)), undefined, true); const iter2: rt.Iter> = rt.iterSlice([rt.btreeFromSorted(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, rt.btreeUnion(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, rt.btreeIntersection(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, rt.btreeDifference(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(Nibble.cmp$Ord) as rt.BTreeSet, rt.btreeSymmetricDifference(_25[0], _25[1]))]); while (true) { - const _73: rt.BTreeSet | rt.Done = iter2.next(); - if (_73 === rt.DONE) { + const _81: rt.BTreeSet | rt.Done = iter2.next(); + if (_81 === rt.DONE) { break; } - const built: rt.BTreeSet = _73; + const built: rt.BTreeSet = _81; putAll$Nibble_Iter_Nibble(rt.btreeKeys(built), put, out); putAll$Nibble_Rev_Iter_Nibble(rt.iterRev(rt.btreeKeys(built)), put, out); } } - const _85: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): Nibble.Nibble => { + const _93: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): Nibble.Nibble => { return make(_23); }); - const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, _85); - const _90: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): Nibble.Nibble => { + const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, _93, undefined, undefined, 469762048); + const _98: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): Nibble.Nibble => { return make(_24); }); - const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, _90); + const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, _98, undefined, undefined, 469762048); const iter3: rt.Iter<[rt.HashSet, rt.HashSet]> = rt.iterSlice([[a2, b2] as [rt.HashSet, rt.HashSet], [b2, a2] as [rt.HashSet, rt.HashSet]]); while (true) { - const _103: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); - if (_103 === rt.DONE) { + const _111: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); + if (_111 === rt.DONE) { break; } - putSorted$Nibble(rt.iterToArray(rt.hashUnion(_103[0], _103[1])), put, out); - putSorted$Nibble(rt.iterToArray(rt.hashIntersection(_103[0], _103[1])), put, out); - putSorted$Nibble(rt.iterToArray(rt.hashDifference(_103[0], _103[1])), put, out); - putSorted$Nibble(rt.iterToArray(rt.hashSymmetricDifference(_103[0], _103[1])), put, out); - rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.hashUnion(_103[0], _103[1]).next()), 221, (v: Nibble.Nibble): rt.u8 => { + putSorted$Nibble(rt.iterToArray(rt.hashUnion(_111[0], _111[1]), undefined, 4), put, out); + putSorted$Nibble(rt.iterToArray(rt.hashIntersection(_111[0], _111[1]), undefined, 4), put, out); + putSorted$Nibble(rt.iterToArray(rt.hashDifference(_111[0], _111[1]), undefined, 4), put, out); + putSorted$Nibble(rt.iterToArray(rt.hashSymmetricDifference(_111[0], _111[1]), undefined, 4), put, out); + putHints$Nibble_Union_Nibble_RandomState(rt.hashUnion(_111[0], _111[1]), 0, out); + putHints$Nibble_Intersection_Nibble_RandomState(rt.hashIntersection(_111[0], _111[1]), 0, out); + putHints$Nibble_Difference_Nibble_RandomState(rt.hashDifference(_111[0], _111[1]), 0, out); + putHints$Nibble_SymmetricDifference_Nibble_RandomState(rt.hashSymmetricDifference(_111[0], _111[1]), 0, out); + rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.hashUnion(_111[0], _111[1]).next()), 221, (v: Nibble.Nibble): rt.u8 => { let _3!: boolean; - if (!rt.hashContains(_103[0], v)) { - _3 = rt.hashContains(_103[1], v); + if (!rt.hashContains(_111[0], v)) { + _3 = rt.hashContains(_111[1], v); } else { _3 = true; } return _3 ? 1 : 0; })); - rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.hashIntersection(_103[0], _103[1]).next()), 221, (v2: Nibble.Nibble): rt.u8 => { + rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.hashIntersection(_111[0], _111[1]).next()), 221, (v2: Nibble.Nibble): rt.u8 => { let _32!: boolean; - if (!rt.hashContains(_103[0], v2)) { + if (!rt.hashContains(_111[0], v2)) { _32 = false; } else { - _32 = rt.hashContains(_103[1], v2); + _32 = rt.hashContains(_111[1], v2); } return _32 ? 1 : 0; })); - rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.hashDifference(_103[0], _103[1]).next()), 221, (v3: Nibble.Nibble): rt.u8 => { - return !rt.hashContains(_103[1], v3) ? 1 : 0; + rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.hashDifference(_111[0], _111[1]).next()), 221, (v3: Nibble.Nibble): rt.u8 => { + return !rt.hashContains(_111[1], v3) ? 1 : 0; })); - rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.hashSymmetricDifference(_103[0], _103[1]).next()), 221, (v4: Nibble.Nibble): rt.u8 => { - return rt.hashContains(_103[0], v4) !== rt.hashContains(_103[1], v4) ? 1 : 0; + rt.byteVecPush(out, mapOr$0q0ymkh(rt.iterToOption(rt.hashSymmetricDifference(_111[0], _111[1]).next()), 221, (v4: Nibble.Nibble): rt.u8 => { + return rt.hashContains(_111[0], v4) !== rt.hashContains(_111[1], v4) ? 1 : 0; })); - rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_103[0], _103[1]) ? 1 : 0, rt.hashIsSuperset(_103[0], _103[1]) ? 1 : 0, rt.hashIsDisjoint(_103[0], _103[1]) ? 1 : 0))); - const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashUnion(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashIntersection(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashDifference(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashSymmetricDifference(_103[0], _103[1]))]); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_111[0], _111[1]) ? 1 : 0, rt.hashIsSuperset(_111[0], _111[1]) ? 1 : 0, rt.hashIsDisjoint(_111[0], _111[1]) ? 1 : 0)), undefined, true); + const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashUnion(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashIntersection(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashDifference(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashSymmetricDifference(_111[0], _111[1]), undefined, undefined, 469762048)]); while (true) { - const _159: rt.HashSet | rt.Done = iter4.next(); - if (_159 === rt.DONE) { + const _175: rt.HashSet | rt.Done = iter4.next(); + if (_175 === rt.DONE) { break; } - putSorted$Nibble(rt.iterToArray(rt.hashKeys(_159)), put, out); + putSorted$Nibble(rt.iterToArray(rt.hashKeys(_175), undefined, 4), put, out); } } } @@ -1742,11 +1756,11 @@ export function setOpsOf$Option_u8(left: rt.ByteSlice, right: rt.ByteSlice, make const _7: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_2: rt.u8): rt.u8 | undefined => { return make(_2); }); - const a: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, _7, true); + const a: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, _7, true, undefined, undefined, 2, true); const _12: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_22: rt.u8): rt.u8 | undefined => { return make(_22); }); - const b: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, _12, true); + const b: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, _12, true, undefined, undefined, 2, true); const iter: rt.Iter<[rt.BTreeSet, rt.BTreeSet]> = rt.iterSlice([[a, b] as [rt.BTreeSet, rt.BTreeSet], [b, a] as [rt.BTreeSet, rt.BTreeSet]]); while (true) { const _25: [rt.BTreeSet, rt.BTreeSet] | rt.Done = iter.next(); @@ -1757,72 +1771,177 @@ export function setOpsOf$Option_u8(left: rt.ByteSlice, right: rt.ByteSlice, make putAll$Option_u8_Intersection_Option_u8(rt.btreeIntersection(_25[0], _25[1]), put, out); putAll$Option_u8_Difference_Option_u8(rt.btreeDifference(_25[0], _25[1]), put, out); putAll$Option_u8_SymmetricDifference_Option_u8(rt.btreeSymmetricDifference(_25[0], _25[1]), put, out); + putHints$Option_u8_Union_Option_u8(rt.btreeUnion(_25[0], _25[1]), 1, out); + putHints$Option_u8_Intersection_Option_u8(rt.btreeIntersection(_25[0], _25[1]), 1, out); + putHints$Option_u8_Difference_Option_u8(rt.btreeDifference(_25[0], _25[1]), 1, out); + putHints$Option_u8_SymmetricDifference_Option_u8(rt.btreeSymmetricDifference(_25[0], _25[1]), 1, out); rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.btreeUnion(_25[0], _25[1]).next(), rt.None), 221, put)); rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.btreeIntersection(_25[0], _25[1]).next(), rt.None), 221, put)); rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.btreeDifference(_25[0], _25[1]).next(), rt.None), 221, put)); rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.btreeSymmetricDifference(_25[0], _25[1]).next(), rt.None), 221, put)); - rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.btreeIsSubset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsSuperset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsDisjoint(_25[0], _25[1]) ? 1 : 0))); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.btreeIsSubset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsSuperset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsDisjoint(_25[0], _25[1]) ? 1 : 0)), undefined, true); const iter2: rt.Iter> = rt.iterSlice([rt.btreeFromSorted(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, rt.btreeUnion(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, rt.btreeIntersection(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, rt.btreeDifference(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmpOption(rt.cmp)) as rt.BTreeSet, rt.btreeSymmetricDifference(_25[0], _25[1]))]); while (true) { - const _73: rt.BTreeSet | rt.Done = iter2.next(); - if (_73 === rt.DONE) { + const _81: rt.BTreeSet | rt.Done = iter2.next(); + if (_81 === rt.DONE) { break; } - const built: rt.BTreeSet = _73; + const built: rt.BTreeSet = _81; putAll$Option_u8_Iter_Option_u8(rt.btreeKeys(built), put, out); putAll$Option_u8_Rev_Iter_Option_u8(rt.iterRev(rt.btreeKeys(built)), put, out); } } - const _85: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): rt.u8 | undefined => { + const _93: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): rt.u8 | undefined => { + return make(_23); + }); + const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, _93, undefined, undefined, 469762048); + const _98: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): rt.u8 | undefined => { + return make(_24); + }); + const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, _98, undefined, undefined, 469762048); + const iter3: rt.Iter<[rt.HashSet, rt.HashSet]> = rt.iterSlice([[a2, b2] as [rt.HashSet, rt.HashSet], [b2, a2] as [rt.HashSet, rt.HashSet]]); + while (true) { + const _111: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); + if (_111 === rt.DONE) { + break; + } + putSorted$Option_u8(rt.iterToArray(rt.hashUnion(_111[0], _111[1]), undefined, 4), put, out); + putSorted$Option_u8(rt.iterToArray(rt.hashIntersection(_111[0], _111[1]), undefined, 4), put, out); + putSorted$Option_u8(rt.iterToArray(rt.hashDifference(_111[0], _111[1]), undefined, 4), put, out); + putSorted$Option_u8(rt.iterToArray(rt.hashSymmetricDifference(_111[0], _111[1]), undefined, 4), put, out); + putHints$Option_u8_Union_Option_u8_RandomState(rt.hashUnion(_111[0], _111[1]), 0, out); + putHints$Option_u8_Intersection_Option_u8_RandomState(rt.hashIntersection(_111[0], _111[1]), 0, out); + putHints$Option_u8_Difference_Option_u8_RandomState(rt.hashDifference(_111[0], _111[1]), 0, out); + putHints$Option_u8_SymmetricDifference_Option_u8_RandomState(rt.hashSymmetricDifference(_111[0], _111[1]), 0, out); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashUnion(_111[0], _111[1]).next(), rt.None), 221, (v: rt.u8 | undefined): rt.u8 => { + let _3!: boolean; + if (!rt.hashContains(_111[0], v)) { + _3 = rt.hashContains(_111[1], v); + } else { + _3 = true; + } + return _3 ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashIntersection(_111[0], _111[1]).next(), rt.None), 221, (v2: rt.u8 | undefined): rt.u8 => { + let _32!: boolean; + if (!rt.hashContains(_111[0], v2)) { + _32 = false; + } else { + _32 = rt.hashContains(_111[1], v2); + } + return _32 ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashDifference(_111[0], _111[1]).next(), rt.None), 221, (v3: rt.u8 | undefined): rt.u8 => { + return !rt.hashContains(_111[1], v3) ? 1 : 0; + })); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashSymmetricDifference(_111[0], _111[1]).next(), rt.None), 221, (v4: rt.u8 | undefined): rt.u8 => { + return rt.hashContains(_111[0], v4) !== rt.hashContains(_111[1], v4) ? 1 : 0; + })); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_111[0], _111[1]) ? 1 : 0, rt.hashIsSuperset(_111[0], _111[1]) ? 1 : 0, rt.hashIsDisjoint(_111[0], _111[1]) ? 1 : 0)), undefined, true); + const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashUnion(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashIntersection(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashDifference(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashSymmetricDifference(_111[0], _111[1]), undefined, undefined, 469762048)]); + while (true) { + const _175: rt.HashSet | rt.Done = iter4.next(); + if (_175 === rt.DONE) { + break; + } + putSorted$Option_u8(rt.iterToArray(rt.hashKeys(_175), undefined, 4), put, out); + } + } +} + +export function setOpsOf$Reverse_Option_u8(left: rt.ByteSlice, right: rt.ByteSlice, make: (a0: rt.u8) => rt.u8 | undefined, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const _7: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_2: rt.u8): rt.u8 | undefined => { + return make(_2); + }); + const a: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpReverse(rt.cmpOption(rt.cmp))) as rt.BTreeSet, _7, true, undefined, undefined, 2, true); + const _12: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_22: rt.u8): rt.u8 | undefined => { + return make(_22); + }); + const b: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpReverse(rt.cmpOption(rt.cmp))) as rt.BTreeSet, _12, true, undefined, undefined, 2, true); + const iter: rt.Iter<[rt.BTreeSet, rt.BTreeSet]> = rt.iterSlice([[a, b] as [rt.BTreeSet, rt.BTreeSet], [b, a] as [rt.BTreeSet, rt.BTreeSet]]); + while (true) { + const _25: [rt.BTreeSet, rt.BTreeSet] | rt.Done = iter.next(); + if (_25 === rt.DONE) { + break; + } + putAll$Reverse_Option_u8_Union_Reverse_Option_u8(rt.btreeUnion(_25[0], _25[1]), put, out); + putAll$Reverse_Option_u8_Intersection_Reverse_Option_u8(rt.btreeIntersection(_25[0], _25[1]), put, out); + putAll$Reverse_Option_u8_Difference_Reverse_Option_u8(rt.btreeDifference(_25[0], _25[1]), put, out); + putAll$Reverse_Option_u8_SymmetricDifference_Reverse_Option_u8(rt.btreeSymmetricDifference(_25[0], _25[1]), put, out); + putHints$Reverse_Option_u8_Union_Reverse_Option_u8(rt.btreeUnion(_25[0], _25[1]), 1, out); + putHints$Reverse_Option_u8_Intersection_Reverse_Option_u8(rt.btreeIntersection(_25[0], _25[1]), 1, out); + putHints$Reverse_Option_u8_Difference_Reverse_Option_u8(rt.btreeDifference(_25[0], _25[1]), 1, out); + putHints$Reverse_Option_u8_SymmetricDifference_Reverse_Option_u8(rt.btreeSymmetricDifference(_25[0], _25[1]), 1, out); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.btreeUnion(_25[0], _25[1]).next(), rt.None), 221, put)); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.btreeIntersection(_25[0], _25[1]).next(), rt.None), 221, put)); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.btreeDifference(_25[0], _25[1]).next(), rt.None), 221, put)); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.btreeSymmetricDifference(_25[0], _25[1]).next(), rt.None), 221, put)); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.btreeIsSubset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsSuperset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsDisjoint(_25[0], _25[1]) ? 1 : 0)), undefined, true); + const iter2: rt.Iter> = rt.iterSlice([rt.btreeFromSorted(rt.btreeNew(rt.cmpReverse(rt.cmpOption(rt.cmp))) as rt.BTreeSet, rt.btreeUnion(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmpReverse(rt.cmpOption(rt.cmp))) as rt.BTreeSet, rt.btreeIntersection(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmpReverse(rt.cmpOption(rt.cmp))) as rt.BTreeSet, rt.btreeDifference(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmpReverse(rt.cmpOption(rt.cmp))) as rt.BTreeSet, rt.btreeSymmetricDifference(_25[0], _25[1]))]); + while (true) { + const _81: rt.BTreeSet | rt.Done = iter2.next(); + if (_81 === rt.DONE) { + break; + } + const built: rt.BTreeSet = _81; + putAll$Reverse_Option_u8_Iter_Reverse_Option_u8(rt.btreeKeys(built), put, out); + putAll$Reverse_Option_u8_Rev_Iter_Reverse_Option_u8(rt.iterRev(rt.btreeKeys(built)), put, out); + } + } + const _93: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): rt.u8 | undefined => { return make(_23); }); - const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, _85); - const _90: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): rt.u8 | undefined => { + const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, _93, undefined, undefined, 469762048); + const _98: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): rt.u8 | undefined => { return make(_24); }); - const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, _90); + const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, _98, undefined, undefined, 469762048); const iter3: rt.Iter<[rt.HashSet, rt.HashSet]> = rt.iterSlice([[a2, b2] as [rt.HashSet, rt.HashSet], [b2, a2] as [rt.HashSet, rt.HashSet]]); while (true) { - const _103: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); - if (_103 === rt.DONE) { + const _111: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); + if (_111 === rt.DONE) { break; } - putSorted$Option_u8(rt.iterToArray(rt.hashUnion(_103[0], _103[1])), put, out); - putSorted$Option_u8(rt.iterToArray(rt.hashIntersection(_103[0], _103[1])), put, out); - putSorted$Option_u8(rt.iterToArray(rt.hashDifference(_103[0], _103[1])), put, out); - putSorted$Option_u8(rt.iterToArray(rt.hashSymmetricDifference(_103[0], _103[1])), put, out); - rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashUnion(_103[0], _103[1]).next(), rt.None), 221, (v: rt.u8 | undefined): rt.u8 => { + putSorted$Reverse_Option_u8(rt.iterToArray(rt.hashUnion(_111[0], _111[1]), undefined, 4), put, out); + putSorted$Reverse_Option_u8(rt.iterToArray(rt.hashIntersection(_111[0], _111[1]), undefined, 4), put, out); + putSorted$Reverse_Option_u8(rt.iterToArray(rt.hashDifference(_111[0], _111[1]), undefined, 4), put, out); + putSorted$Reverse_Option_u8(rt.iterToArray(rt.hashSymmetricDifference(_111[0], _111[1]), undefined, 4), put, out); + putHints$Reverse_Option_u8_Union_Reverse_Option_u8_RandomState(rt.hashUnion(_111[0], _111[1]), 0, out); + putHints$Reverse_Option_u8_Intersection_Reverse_Option_u8_RandomState(rt.hashIntersection(_111[0], _111[1]), 0, out); + putHints$Reverse_Option_u8_Difference_Reverse_Option_u8_RandomState(rt.hashDifference(_111[0], _111[1]), 0, out); + putHints$Reverse_Option_u8_SymmetricDifference_Reverse_Option_u8_RandomState(rt.hashSymmetricDifference(_111[0], _111[1]), 0, out); + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashUnion(_111[0], _111[1]).next(), rt.None), 221, (v: rt.u8 | undefined): rt.u8 => { let _3!: boolean; - if (!rt.hashContains(_103[0], v)) { - _3 = rt.hashContains(_103[1], v); + if (!rt.hashContains(_111[0], v)) { + _3 = rt.hashContains(_111[1], v); } else { _3 = true; } return _3 ? 1 : 0; })); - rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashIntersection(_103[0], _103[1]).next(), rt.None), 221, (v2: rt.u8 | undefined): rt.u8 => { + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashIntersection(_111[0], _111[1]).next(), rt.None), 221, (v2: rt.u8 | undefined): rt.u8 => { let _32!: boolean; - if (!rt.hashContains(_103[0], v2)) { + if (!rt.hashContains(_111[0], v2)) { _32 = false; } else { - _32 = rt.hashContains(_103[1], v2); + _32 = rt.hashContains(_111[1], v2); } return _32 ? 1 : 0; })); - rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashDifference(_103[0], _103[1]).next(), rt.None), 221, (v3: rt.u8 | undefined): rt.u8 => { - return !rt.hashContains(_103[1], v3) ? 1 : 0; + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashDifference(_111[0], _111[1]).next(), rt.None), 221, (v3: rt.u8 | undefined): rt.u8 => { + return !rt.hashContains(_111[1], v3) ? 1 : 0; })); - rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashSymmetricDifference(_103[0], _103[1]).next(), rt.None), 221, (v4: rt.u8 | undefined): rt.u8 => { - return rt.hashContains(_103[0], v4) !== rt.hashContains(_103[1], v4) ? 1 : 0; + rt.byteVecPush(out, mapOr$1xztl8h(rt.iterToOption(rt.hashSymmetricDifference(_111[0], _111[1]).next(), rt.None), 221, (v4: rt.u8 | undefined): rt.u8 => { + return rt.hashContains(_111[0], v4) !== rt.hashContains(_111[1], v4) ? 1 : 0; })); - rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_103[0], _103[1]) ? 1 : 0, rt.hashIsSuperset(_103[0], _103[1]) ? 1 : 0, rt.hashIsDisjoint(_103[0], _103[1]) ? 1 : 0))); - const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashUnion(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashIntersection(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashDifference(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashSymmetricDifference(_103[0], _103[1]))]); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_111[0], _111[1]) ? 1 : 0, rt.hashIsSuperset(_111[0], _111[1]) ? 1 : 0, rt.hashIsDisjoint(_111[0], _111[1]) ? 1 : 0)), undefined, true); + const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashUnion(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashIntersection(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashDifference(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashOption(rt.hash8), rt.same)) as rt.HashSet, rt.hashSymmetricDifference(_111[0], _111[1]), undefined, undefined, 469762048)]); while (true) { - const _159: rt.HashSet | rt.Done = iter4.next(); - if (_159 === rt.DONE) { + const _175: rt.HashSet | rt.Done = iter4.next(); + if (_175 === rt.DONE) { break; } - putSorted$Option_u8(rt.iterToArray(rt.hashKeys(_159)), put, out); + putSorted$Reverse_Option_u8(rt.iterToArray(rt.hashKeys(_175), undefined, 4), put, out); } } } @@ -1831,11 +1950,11 @@ export function setOpsOf$u8(left: rt.ByteSlice, right: rt.ByteSlice, make: (a0: const _7: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_2: rt.u8): rt.u8 => { return make(_2); }); - const a: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmp) as rt.BTreeSet, _7, true); + const a: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmp) as rt.BTreeSet, _7, true, undefined, undefined, 1, true); const _12: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_22: rt.u8): rt.u8 => { return make(_22); }); - const b: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmp) as rt.BTreeSet, _12, true); + const b: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmp) as rt.BTreeSet, _12, true, undefined, undefined, 1, true); const iter: rt.Iter<[rt.BTreeSet, rt.BTreeSet]> = rt.iterSlice([[a, b] as [rt.BTreeSet, rt.BTreeSet], [b, a] as [rt.BTreeSet, rt.BTreeSet]]); while (true) { const _25: [rt.BTreeSet, rt.BTreeSet] | rt.Done = iter.next(); @@ -1846,72 +1965,80 @@ export function setOpsOf$u8(left: rt.ByteSlice, right: rt.ByteSlice, make: (a0: putAll$u8_Intersection_u8(rt.btreeIntersection(_25[0], _25[1]), put, out); putAll$u8_Difference_u8(rt.btreeDifference(_25[0], _25[1]), put, out); putAll$u8_SymmetricDifference_u8(rt.btreeSymmetricDifference(_25[0], _25[1]), put, out); + putHints$u8_Union_u8(rt.btreeUnion(_25[0], _25[1]), 1, out); + putHints$u8_Intersection_u8(rt.btreeIntersection(_25[0], _25[1]), 1, out); + putHints$u8_Difference_u8(rt.btreeDifference(_25[0], _25[1]), 1, out); + putHints$u8_SymmetricDifference_u8(rt.btreeSymmetricDifference(_25[0], _25[1]), 1, out); rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.btreeUnion(_25[0], _25[1]).next()), 221, put)); rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.btreeIntersection(_25[0], _25[1]).next()), 221, put)); rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.btreeDifference(_25[0], _25[1]).next()), 221, put)); rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.btreeSymmetricDifference(_25[0], _25[1]).next()), 221, put)); - rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.btreeIsSubset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsSuperset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsDisjoint(_25[0], _25[1]) ? 1 : 0))); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.btreeIsSubset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsSuperset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsDisjoint(_25[0], _25[1]) ? 1 : 0)), undefined, true); const iter2: rt.Iter> = rt.iterSlice([rt.btreeFromSorted(rt.btreeNew(rt.cmp) as rt.BTreeSet, rt.btreeUnion(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmp) as rt.BTreeSet, rt.btreeIntersection(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmp) as rt.BTreeSet, rt.btreeDifference(_25[0], _25[1])), rt.btreeFromSorted(rt.btreeNew(rt.cmp) as rt.BTreeSet, rt.btreeSymmetricDifference(_25[0], _25[1]))]); while (true) { - const _73: rt.BTreeSet | rt.Done = iter2.next(); - if (_73 === rt.DONE) { + const _81: rt.BTreeSet | rt.Done = iter2.next(); + if (_81 === rt.DONE) { break; } - const built: rt.BTreeSet = _73; + const built: rt.BTreeSet = _81; putAll$u8_Iter_u8(rt.btreeKeys(built), put, out); putAll$u8_Rev_Iter_u8(rt.iterRev(rt.btreeKeys(built)), put, out); } } - const _85: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): rt.u8 => { + const _93: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): rt.u8 => { return make(_23); }); - const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew() as rt.HashSet, _85); - const _90: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): rt.u8 => { + const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew() as rt.HashSet, _93, undefined, undefined, 469762048); + const _98: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): rt.u8 => { return make(_24); }); - const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew() as rt.HashSet, _90); + const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew() as rt.HashSet, _98, undefined, undefined, 469762048); const iter3: rt.Iter<[rt.HashSet, rt.HashSet]> = rt.iterSlice([[a2, b2] as [rt.HashSet, rt.HashSet], [b2, a2] as [rt.HashSet, rt.HashSet]]); while (true) { - const _103: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); - if (_103 === rt.DONE) { + const _111: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); + if (_111 === rt.DONE) { break; } - putSorted$u8(rt.iterToArray(rt.hashUnion(_103[0], _103[1])), put, out); - putSorted$u8(rt.iterToArray(rt.hashIntersection(_103[0], _103[1])), put, out); - putSorted$u8(rt.iterToArray(rt.hashDifference(_103[0], _103[1])), put, out); - putSorted$u8(rt.iterToArray(rt.hashSymmetricDifference(_103[0], _103[1])), put, out); - rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.hashUnion(_103[0], _103[1]).next()), 221, (v: rt.u8): rt.u8 => { + putSorted$u8(rt.iterToArray(rt.hashUnion(_111[0], _111[1]), undefined, 4), put, out); + putSorted$u8(rt.iterToArray(rt.hashIntersection(_111[0], _111[1]), undefined, 4), put, out); + putSorted$u8(rt.iterToArray(rt.hashDifference(_111[0], _111[1]), undefined, 4), put, out); + putSorted$u8(rt.iterToArray(rt.hashSymmetricDifference(_111[0], _111[1]), undefined, 4), put, out); + putHints$u8_Union_u8_RandomState(rt.hashUnion(_111[0], _111[1]), 0, out); + putHints$u8_Intersection_u8_RandomState(rt.hashIntersection(_111[0], _111[1]), 0, out); + putHints$u8_Difference_u8_RandomState(rt.hashDifference(_111[0], _111[1]), 0, out); + putHints$u8_SymmetricDifference_u8_RandomState(rt.hashSymmetricDifference(_111[0], _111[1]), 0, out); + rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.hashUnion(_111[0], _111[1]).next()), 221, (v: rt.u8): rt.u8 => { let _3!: boolean; - if (!rt.hashContains(_103[0], v)) { - _3 = rt.hashContains(_103[1], v); + if (!rt.hashContains(_111[0], v)) { + _3 = rt.hashContains(_111[1], v); } else { _3 = true; } return _3 ? 1 : 0; })); - rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.hashIntersection(_103[0], _103[1]).next()), 221, (v2: rt.u8): rt.u8 => { + rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.hashIntersection(_111[0], _111[1]).next()), 221, (v2: rt.u8): rt.u8 => { let _32!: boolean; - if (!rt.hashContains(_103[0], v2)) { + if (!rt.hashContains(_111[0], v2)) { _32 = false; } else { - _32 = rt.hashContains(_103[1], v2); + _32 = rt.hashContains(_111[1], v2); } return _32 ? 1 : 0; })); - rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.hashDifference(_103[0], _103[1]).next()), 221, (v3: rt.u8): rt.u8 => { - return !rt.hashContains(_103[1], v3) ? 1 : 0; + rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.hashDifference(_111[0], _111[1]).next()), 221, (v3: rt.u8): rt.u8 => { + return !rt.hashContains(_111[1], v3) ? 1 : 0; })); - rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.hashSymmetricDifference(_103[0], _103[1]).next()), 221, (v4: rt.u8): rt.u8 => { - return rt.hashContains(_103[0], v4) !== rt.hashContains(_103[1], v4) ? 1 : 0; + rt.byteVecPush(out, mapOr$1surhce(rt.iterToOption(rt.hashSymmetricDifference(_111[0], _111[1]).next()), 221, (v4: rt.u8): rt.u8 => { + return rt.hashContains(_111[0], v4) !== rt.hashContains(_111[1], v4) ? 1 : 0; })); - rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_103[0], _103[1]) ? 1 : 0, rt.hashIsSuperset(_103[0], _103[1]) ? 1 : 0, rt.hashIsDisjoint(_103[0], _103[1]) ? 1 : 0))); - const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew() as rt.HashSet, rt.hashUnion(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew() as rt.HashSet, rt.hashIntersection(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew() as rt.HashSet, rt.hashDifference(_103[0], _103[1])), rt.hashExtendKeys(rt.hashNew() as rt.HashSet, rt.hashSymmetricDifference(_103[0], _103[1]))]); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_111[0], _111[1]) ? 1 : 0, rt.hashIsSuperset(_111[0], _111[1]) ? 1 : 0, rt.hashIsDisjoint(_111[0], _111[1]) ? 1 : 0)), undefined, true); + const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew() as rt.HashSet, rt.hashUnion(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew() as rt.HashSet, rt.hashIntersection(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew() as rt.HashSet, rt.hashDifference(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew() as rt.HashSet, rt.hashSymmetricDifference(_111[0], _111[1]), undefined, undefined, 469762048)]); while (true) { - const _159: rt.HashSet | rt.Done = iter4.next(); - if (_159 === rt.DONE) { + const _175: rt.HashSet | rt.Done = iter4.next(); + if (_175 === rt.DONE) { break; } - putSorted$u8(rt.iterToArray(rt.hashKeys(_159)), put, out); + putSorted$u8(rt.iterToArray(rt.hashKeys(_175), undefined, 4), put, out); } } } @@ -1920,11 +2047,11 @@ export function setOpsOf$u8s(left: rt.ByteSlice, right: rt.ByteSlice, make: (a0: const _7: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_2: rt.u8): Uint8Array => { return make(_2); }); - const a: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, _7, true); + const a: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, _7, true, undefined, undefined, 2, true); const _12: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_22: rt.u8): Uint8Array => { return make(_22); }); - const b: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, _12, true); + const b: rt.BTreeSet = rt.btreeExtendKeys(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, _12, true, undefined, undefined, 2, true); const iter: rt.Iter<[rt.BTreeSet, rt.BTreeSet]> = rt.iterSlice([[a, b] as [rt.BTreeSet, rt.BTreeSet], [b, a] as [rt.BTreeSet, rt.BTreeSet]]); while (true) { const _25: [rt.BTreeSet, rt.BTreeSet] | rt.Done = iter.next(); @@ -1935,72 +2062,80 @@ export function setOpsOf$u8s(left: rt.ByteSlice, right: rt.ByteSlice, make: (a0: putAll$u8s_Intersection_u8s(rt.iterMap(rt.btreeIntersection(_25[0], _25[1]), rt.byteSliceFrom), put, out); putAll$u8s_Difference_u8s(rt.iterMap(rt.btreeDifference(_25[0], _25[1]), rt.byteSliceFrom), put, out); putAll$u8s_SymmetricDifference_u8s(rt.iterMap(rt.btreeSymmetricDifference(_25[0], _25[1]), rt.byteSliceFrom), put, out); + putHints$u8s_Union_u8s(rt.iterMap(rt.btreeUnion(_25[0], _25[1]), rt.byteSliceFrom), 1, out); + putHints$u8s_Intersection_u8s(rt.iterMap(rt.btreeIntersection(_25[0], _25[1]), rt.byteSliceFrom), 1, out); + putHints$u8s_Difference_u8s(rt.iterMap(rt.btreeDifference(_25[0], _25[1]), rt.byteSliceFrom), 1, out); + putHints$u8s_SymmetricDifference_u8s(rt.iterMap(rt.btreeSymmetricDifference(_25[0], _25[1]), rt.byteSliceFrom), 1, out); rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.btreeUnion(_25[0], _25[1]), rt.byteSliceFrom).next()), 221, put)); rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.btreeIntersection(_25[0], _25[1]), rt.byteSliceFrom).next()), 221, put)); rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.btreeDifference(_25[0], _25[1]), rt.byteSliceFrom).next()), 221, put)); rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.btreeSymmetricDifference(_25[0], _25[1]), rt.byteSliceFrom).next()), 221, put)); - rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.btreeIsSubset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsSuperset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsDisjoint(_25[0], _25[1]) ? 1 : 0))); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.btreeIsSubset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsSuperset(_25[0], _25[1]) ? 1 : 0, rt.btreeIsDisjoint(_25[0], _25[1]) ? 1 : 0)), undefined, true); const iter2: rt.Iter> = rt.iterSlice([rt.btreeFromSorted(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, rt.iterMap(rt.btreeUnion(_25[0], _25[1]), copy$u8s)), rt.btreeFromSorted(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, rt.iterMap(rt.btreeIntersection(_25[0], _25[1]), copy$u8s)), rt.btreeFromSorted(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, rt.iterMap(rt.btreeDifference(_25[0], _25[1]), copy$u8s)), rt.btreeFromSorted(rt.btreeNew(rt.cmpBytes) as rt.BTreeSet, rt.iterMap(rt.btreeSymmetricDifference(_25[0], _25[1]), copy$u8s))]); while (true) { - const _73: rt.BTreeSet | rt.Done = iter2.next(); - if (_73 === rt.DONE) { + const _81: rt.BTreeSet | rt.Done = iter2.next(); + if (_81 === rt.DONE) { break; } - const built: rt.BTreeSet = _73; + const built: rt.BTreeSet = _81; putAll$u8s_Iter_u8s(rt.iterMap(rt.btreeKeys(built), rt.byteSliceFrom), put, out); putAll$u8s_Rev_Iter_u8s(rt.iterRev(rt.iterMap(rt.btreeKeys(built), rt.byteSliceFrom)), put, out); } } - const _85: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): Uint8Array => { + const _93: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): Uint8Array => { return make(_23); }); - const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, _85); - const _90: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): Uint8Array => { + const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, _93, undefined, undefined, 469762048); + const _98: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): Uint8Array => { return make(_24); }); - const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, _90); + const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, _98, undefined, undefined, 469762048); const iter3: rt.Iter<[rt.HashSet, rt.HashSet]> = rt.iterSlice([[a2, b2] as [rt.HashSet, rt.HashSet], [b2, a2] as [rt.HashSet, rt.HashSet]]); while (true) { - const _103: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); - if (_103 === rt.DONE) { + const _111: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); + if (_111 === rt.DONE) { break; } - putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashUnion(_103[0], _103[1]), rt.byteSliceFrom)), put, out); - putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashIntersection(_103[0], _103[1]), rt.byteSliceFrom)), put, out); - putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashDifference(_103[0], _103[1]), rt.byteSliceFrom)), put, out); - putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashSymmetricDifference(_103[0], _103[1]), rt.byteSliceFrom)), put, out); - rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.hashUnion(_103[0], _103[1]), rt.byteSliceFrom).next()), 221, (v: rt.ByteSlice): rt.u8 => { + putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashUnion(_111[0], _111[1]), rt.byteSliceFrom), undefined, 4), put, out); + putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashIntersection(_111[0], _111[1]), rt.byteSliceFrom), undefined, 4), put, out); + putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashDifference(_111[0], _111[1]), rt.byteSliceFrom), undefined, 4), put, out); + putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashSymmetricDifference(_111[0], _111[1]), rt.byteSliceFrom), undefined, 4), put, out); + putHints$u8s_Union_u8s_RandomState(rt.iterMap(rt.hashUnion(_111[0], _111[1]), rt.byteSliceFrom), 0, out); + putHints$u8s_Intersection_u8s_RandomState(rt.iterMap(rt.hashIntersection(_111[0], _111[1]), rt.byteSliceFrom), 0, out); + putHints$u8s_Difference_u8s_RandomState(rt.iterMap(rt.hashDifference(_111[0], _111[1]), rt.byteSliceFrom), 0, out); + putHints$u8s_SymmetricDifference_u8s_RandomState(rt.iterMap(rt.hashSymmetricDifference(_111[0], _111[1]), rt.byteSliceFrom), 0, out); + rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.hashUnion(_111[0], _111[1]), rt.byteSliceFrom).next()), 221, (v: rt.ByteSlice): rt.u8 => { let _3!: boolean; - if (!rt.hashContains(_103[0], rt.byteSliceView(v))) { - _3 = rt.hashContains(_103[1], rt.byteSliceView(v)); + if (!rt.hashContains(_111[0], rt.byteSliceView(v))) { + _3 = rt.hashContains(_111[1], rt.byteSliceView(v)); } else { _3 = true; } return _3 ? 1 : 0; })); - rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.hashIntersection(_103[0], _103[1]), rt.byteSliceFrom).next()), 221, (v2: rt.ByteSlice): rt.u8 => { + rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.hashIntersection(_111[0], _111[1]), rt.byteSliceFrom).next()), 221, (v2: rt.ByteSlice): rt.u8 => { let _32!: boolean; - if (!rt.hashContains(_103[0], rt.byteSliceView(v2))) { + if (!rt.hashContains(_111[0], rt.byteSliceView(v2))) { _32 = false; } else { - _32 = rt.hashContains(_103[1], rt.byteSliceView(v2)); + _32 = rt.hashContains(_111[1], rt.byteSliceView(v2)); } return _32 ? 1 : 0; })); - rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.hashDifference(_103[0], _103[1]), rt.byteSliceFrom).next()), 221, (v3: rt.ByteSlice): rt.u8 => { - return !rt.hashContains(_103[1], rt.byteSliceView(v3)) ? 1 : 0; + rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.hashDifference(_111[0], _111[1]), rt.byteSliceFrom).next()), 221, (v3: rt.ByteSlice): rt.u8 => { + return !rt.hashContains(_111[1], rt.byteSliceView(v3)) ? 1 : 0; })); - rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.hashSymmetricDifference(_103[0], _103[1]), rt.byteSliceFrom).next()), 221, (v4: rt.ByteSlice): rt.u8 => { - return rt.hashContains(_103[0], rt.byteSliceView(v4)) !== rt.hashContains(_103[1], rt.byteSliceView(v4)) ? 1 : 0; + rt.byteVecPush(out, mapOr$1w1gbwl(rt.iterToOption(rt.iterMap(rt.hashSymmetricDifference(_111[0], _111[1]), rt.byteSliceFrom).next()), 221, (v4: rt.ByteSlice): rt.u8 => { + return rt.hashContains(_111[0], rt.byteSliceView(v4)) !== rt.hashContains(_111[1], rt.byteSliceView(v4)) ? 1 : 0; })); - rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_103[0], _103[1]) ? 1 : 0, rt.hashIsSuperset(_103[0], _103[1]) ? 1 : 0, rt.hashIsDisjoint(_103[0], _103[1]) ? 1 : 0))); - const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, rt.iterMap(rt.hashUnion(_103[0], _103[1]), copy$u8s)), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, rt.iterMap(rt.hashIntersection(_103[0], _103[1]), copy$u8s)), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, rt.iterMap(rt.hashDifference(_103[0], _103[1]), copy$u8s)), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, rt.iterMap(rt.hashSymmetricDifference(_103[0], _103[1]), copy$u8s))]); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_111[0], _111[1]) ? 1 : 0, rt.hashIsSuperset(_111[0], _111[1]) ? 1 : 0, rt.hashIsDisjoint(_111[0], _111[1]) ? 1 : 0)), undefined, true); + const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, rt.iterMap(rt.hashUnion(_111[0], _111[1]), copy$u8s), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, rt.iterMap(rt.hashIntersection(_111[0], _111[1]), copy$u8s), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, rt.iterMap(rt.hashDifference(_111[0], _111[1]), copy$u8s), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(rt.hashBytes, rt.eqBytes)) as rt.HashSet, rt.iterMap(rt.hashSymmetricDifference(_111[0], _111[1]), copy$u8s), undefined, undefined, 469762048)]); while (true) { - const _159: rt.HashSet | rt.Done = iter4.next(); - if (_159 === rt.DONE) { + const _175: rt.HashSet | rt.Done = iter4.next(); + if (_175 === rt.DONE) { break; } - putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashKeys(_159), rt.byteSliceFrom)), put, out); + putSorted$u8s(rt.iterToArray(rt.iterMap(rt.hashKeys(_175), rt.byteSliceFrom), undefined, 4), put, out); } } } @@ -2229,6 +2364,118 @@ export function putAll$Option_u8_Union_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Reverse_Option_u8_Intersection_Reverse_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Reverse_Option_u8_IntoIter_Reverse_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Reverse_Option_u8_Iter_Reverse_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Reverse_Option_u8_Rev_Iter_Reverse_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Reverse_Option_u8_SymmetricDifference_Reverse_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + +/** How many `items` there are, then each. */ +export function putAll$Reverse_Option_u8_Union_Reverse_Option_u8(items: rt.Iter, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + const at: rt.usize = out.length; + rt.byteVecPush(out, 0); + const iter: rt.Iter = items; + while (true) { + const _9: rt.u8 | undefined | rt.Done = iter.next(); + if (_9 === rt.DONE) { + break; + } + rt.byteVecPush(out, put(_9)); + } + const _15: rt.usize = rt.usizeSub(rt.usizeSub(out.length, at), 1); + out.data[rt.idx(out, at)] = _15 & 0xff; +} + /** How many `items` there are, then each. */ export function putAll$u8_Difference_u8(items: rt.Iter, put: (a0: rt.u8) => rt.u8, out: rt.ByteVec): void { const at: rt.usize = out.length; @@ -2453,6 +2700,726 @@ export function putAll$u8s_Union_u8s(items: rt.Iter, put: (a0: rt. out.data[rt.idx(out, at)] = _15 & 0xff; } +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Nibble_Difference_Nibble(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Nibble_Difference_Nibble_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Nibble_Intersection_Nibble(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Nibble_Intersection_Nibble_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Nibble_SymmetricDifference_Nibble(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Nibble_SymmetricDifference_Nibble_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Nibble_Union_Nibble(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Nibble_Union_Nibble_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Option_u8_Difference_Option_u8(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Option_u8_Difference_Option_u8_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Option_u8_Intersection_Option_u8(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Option_u8_Intersection_Option_u8_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Option_u8_SymmetricDifference_Option_u8(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Option_u8_SymmetricDifference_Option_u8_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Option_u8_Union_Option_u8(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Option_u8_Union_Option_u8_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Reverse_Option_u8_Difference_Reverse_Option_u8(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Reverse_Option_u8_Difference_Reverse_Option_u8_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Reverse_Option_u8_Intersection_Reverse_Option_u8(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Reverse_Option_u8_Intersection_Reverse_Option_u8_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Reverse_Option_u8_SymmetricDifference_Reverse_Option_u8(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Reverse_Option_u8_SymmetricDifference_Reverse_Option_u8_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Reverse_Option_u8_Union_Reverse_Option_u8(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$Reverse_Option_u8_Union_Reverse_Option_u8_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8_Difference_u8(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8_Difference_u8_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8_Intersection_u8(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8_Intersection_u8_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8_SymmetricDifference_u8(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8_SymmetricDifference_u8_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8_Union_u8(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8_Union_u8_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8s_Difference_u8s(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8s_Difference_u8s_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8s_Intersection_u8s(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8s_Intersection_u8s_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8s_SymmetricDifference_u8s(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8s_SymmetricDifference_u8s_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8s_Union_u8s(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + +/** The size hint of `items`, and again after each of `read` more. */ +export function putHints$u8s_Union_u8s_RandomState(items: rt.Iter, read: rt.usize, out: rt.ByteVec): void { + const iter: rt.RangeInclusive = new rt.RangeInclusive(0, read, rt.usizeStep); + while (true) { + const _7: rt.usize | rt.Done = iter.next(); + if (_7 === rt.DONE) { + break; + } + if (_7 > 0) { + items.next(); + } + const _16: [rt.usize, rt.usize | undefined] = items.sizeHint(); + rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(_16[0] & 0xff, mapOr$02k4ito(_16[1], 255, (n: rt.usize): rt.u8 => { + return n & 0xff; + }))), undefined, true); + } +} + /** [`put_all`] of `items` in order. */ export function putSorted$Nibble(items: Nibble.Nibble[], put: (a0: Nibble.Nibble) => rt.u8, out: rt.ByteVec): void { rt.sliceSort(items, rt.cmpLt(Nibble.partialCmp$PartialOrd)); @@ -2465,6 +3432,12 @@ export function putSorted$Option_u8(items: Array, put: (a0: r putAll$Option_u8_IntoIter_Option_u8(rt.iterSlice(items), put, out); } +/** [`put_all`] of `items` in order. */ +export function putSorted$Reverse_Option_u8(items: Array, put: (a0: rt.u8 | undefined) => rt.u8, out: rt.ByteVec): void { + rt.sliceSort(items, rt.cmpLt(rt.cmpReverse(rt.cmpOption(rt.cmp)))); + putAll$Reverse_Option_u8_IntoIter_Reverse_Option_u8(rt.iterSlice(items), put, out); +} + /** [`put_all`] of `items` in order. */ export function putSorted$u8(items: rt.u8[], put: (a0: rt.u8) => rt.u8, out: rt.ByteVec): void { rt.sliceSort(items, rt.lt); diff --git a/ts/fixtures/lang/expected/harness.ts b/ts/fixtures/lang/expected/harness.ts index 7299a3f7a..ee316b031 100644 --- a/ts/fixtures/lang/expected/harness.ts +++ b/ts/fixtures/lang/expected/harness.ts @@ -9,7 +9,7 @@ import { captures } from "./captures.ts"; import { cells } from "./cells.ts"; import { chars } from "./chars.ts"; import { chunks } from "./chunks.ts"; -import { hashMaps, sets, btreeMaps, deques, vecs, stores, optionals } from "./collections.ts"; +import { hashMaps, sets, btreeMaps, deques, vecs, stores, optionals, setOps } from "./collections.ts"; import { combinators } from "./combinators.ts"; import { arcs, clonedArcs, cyclicArcs, uniqueArcs, clonedRcs, cyclicRcs, rcs, uniqueRcs, copies } from "./counts.ts"; import { cows } from "./cows.ts"; @@ -186,7 +186,7 @@ export function cases(): [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) uninhabited(data67, out68); }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["keys::lent_keys", lentKeys] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["keys::lent_values", lentValues] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["singles::singles", singles] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["singles::formats", singles_formats] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["singles::parses", singles_parses] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["iters::peeked_others", (_2168: rt.u8, data68: rt.ByteSlice, out69: rt.ByteVec): void => { peekedOthers(data68, out69); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["hints::hints", hints] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["hints::reserves", reserves] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void]]; + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["hints::hints", hints] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["hints::reserves", reserves] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void], ["collections::set_ops", setOps] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => void]]; } /** Run one case. */ From c7d13638de063686d850d1ec57906aa371d9bab5 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Fri, 30 Oct 2026 14:05:27 -0700 Subject: [PATCH 4/4] test(ts): regenerate the lang harness after merging main Co-Authored-By: Claude Opus 5.5 --- ts/fixtures/lang/expected/collections.ts | 6 +++--- ts/fixtures/lang/expected/harness.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ts/fixtures/lang/expected/collections.ts b/ts/fixtures/lang/expected/collections.ts index b1f12400f..2609e0f3d 100644 --- a/ts/fixtures/lang/expected/collections.ts +++ b/ts/fixtures/lang/expected/collections.ts @@ -1697,11 +1697,11 @@ export function setOpsOf$Nibble(left: rt.ByteSlice, right: rt.ByteSlice, make: ( const _93: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(left)), (_23: rt.u8): Nibble.Nibble => { return make(_23); }); - const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, _93, undefined, undefined, 469762048); + const a2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher as (a0: Nibble.Nibble, a1: rt.Hasher) => undefined, Nibble.eq$PartialEq)) as rt.HashSet, _93, undefined, undefined, 469762048); const _98: rt.Iter = rt.iterMap(rt.iterSlice(rt.byteSliceView(right)), (_24: rt.u8): Nibble.Nibble => { return make(_24); }); - const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, _98, undefined, undefined, 469762048); + const b2: rt.HashSet = rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher as (a0: Nibble.Nibble, a1: rt.Hasher) => undefined, Nibble.eq$PartialEq)) as rt.HashSet, _98, undefined, undefined, 469762048); const iter3: rt.Iter<[rt.HashSet, rt.HashSet]> = rt.iterSlice([[a2, b2] as [rt.HashSet, rt.HashSet], [b2, a2] as [rt.HashSet, rt.HashSet]]); while (true) { const _111: [rt.HashSet, rt.HashSet] | rt.Done = iter3.next(); @@ -1741,7 +1741,7 @@ export function setOpsOf$Nibble(left: rt.ByteSlice, right: rt.ByteSlice, make: ( return rt.hashContains(_111[0], v4) !== rt.hashContains(_111[1], v4) ? 1 : 0; })); rt.iterExtendBytes(out, rt.iterSlice(Uint8Array.of(rt.hashIsSubset(_111[0], _111[1]) ? 1 : 0, rt.hashIsSuperset(_111[0], _111[1]) ? 1 : 0, rt.hashIsDisjoint(_111[0], _111[1]) ? 1 : 0)), undefined, true); - const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashUnion(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashIntersection(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashDifference(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashSymmetricDifference(_111[0], _111[1]), undefined, undefined, 469762048)]); + const iter4: rt.Iter> = rt.iterSlice([rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher as (a0: Nibble.Nibble, a1: rt.Hasher) => undefined, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashUnion(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher as (a0: Nibble.Nibble, a1: rt.Hasher) => undefined, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashIntersection(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher as (a0: Nibble.Nibble, a1: rt.Hasher) => undefined, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashDifference(_111[0], _111[1]), undefined, undefined, 469762048), rt.hashExtendKeys(rt.hashNew(rt.hashing(Nibble.hash$Hash_DefaultHasher as (a0: Nibble.Nibble, a1: rt.Hasher) => undefined, Nibble.eq$PartialEq)) as rt.HashSet, rt.hashSymmetricDifference(_111[0], _111[1]), undefined, undefined, 469762048)]); while (true) { const _175: rt.HashSet | rt.Done = iter4.next(); if (_175 === rt.DONE) { diff --git a/ts/fixtures/lang/expected/harness.ts b/ts/fixtures/lang/expected/harness.ts index 2fcd0f82c..d1f263d5c 100644 --- a/ts/fixtures/lang/expected/harness.ts +++ b/ts/fixtures/lang/expected/harness.ts @@ -9,7 +9,7 @@ import { captures } from "./captures.ts"; import { cells } from "./cells.ts"; import { chars } from "./chars.ts"; import { chunks } from "./chunks.ts"; -import { hashMaps, sets, btreeMaps, deques, vecs, stores, optionals } from "./collections.ts"; +import { hashMaps, sets, btreeMaps, deques, vecs, stores, optionals, setOps } from "./collections.ts"; import { combinators } from "./combinators.ts"; import { arcs, clonedArcs, cyclicArcs, uniqueArcs, clonedRcs, cyclicRcs, rcs, uniqueRcs, copies } from "./counts.ts"; import { cows } from "./cows.ts"; @@ -186,7 +186,7 @@ export function cases(): [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) uninhabited(data67, out68); }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["keys::lent_keys", lentKeys as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["keys::lent_values", lentValues as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["singles::singles", singles as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["singles::formats", singles_formats as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["singles::parses", singles_parses as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["iters::peeked_others", (_2168: rt.u8, data68: rt.ByteSlice, out69: rt.ByteVec): undefined => { peekedOthers(data68, out69); - }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["hints::hints", hints as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["hints::reserves", reserves as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined]]; + }] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["hints::hints", hints as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["hints::reserves", reserves as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined], ["collections::set_ops", setOps as (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined] as [string, (a0: rt.u8, a1: rt.ByteSlice, a2: rt.ByteVec) => undefined]]; } /** Run one case. */