collections: Heap, a priority structure ordered by a key (C7) #200
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Heap<Item>: the priority structure of COLLECTIONS.md section 3.4. It is not aQueueand has no trait; the ordering is a value it carries (Heap.by { _.priority }). The record still calls itOrderedin the snippet and in the C7 text; the owner renamed it toHeapon 2026-09-23 (section 6, question 4). Open: the member words (see the owner decision on #139), so this issue is not ready until it is answered.Acceptance criteria
public type Heap<Item>over aListas a binary heap, built withHeap.by(key), O(log n) insert/take-smallest, O(1) peek.length/cleardecided with the member words.Ordered/Collectionsnippet in COLLECTIONS.md section 3.4 and the C7 text updated in the same PR.List.sort.Seed impact
None. A new public type in
std/collectionswritten in plain TorbScript over aList; no syntax change, no new native, no runtime change (runtime/list.cstays the one storage, COLLECTIONS.md section 3.10 point 5), and the compiler looks up none of the new names by string (section 6a). Not breaking: only additions.Size
One PR, one
feat(collections)commit (plus tests and docs in the same commit or a secondtest/docsone).Common to the C7 types
std/collections/src/lib.trb(public use ...), doc comments with the cost profile of the implementation, asArrayQueuehas.tests/conformance/(.trb+.expected), run natively and in the VM, in the style ofqueue-grows.trb.benchmarks/(one small program plus its C counterpart, seebenchmarks/README.md) against the array implementation. It is a measurement, not a gate.skills/regenerated when docs change; the worker does not run gates locally, CI does.Source
RingList,ConsStack,BankersQueue,Heap(C7) #139RingList,ConsStack,BankersQueue,Heap(C7) #139RingList,ConsStack,BankersQueue,Heap(C7) #139[loop:torbscript] owner decision recorded (torben via WhatsApp, 2026-10-08 16:35 Europe/Berlin): member words
insert/removeSmallest/peekSmallest(see #139). Labelledready.[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T21:10Z
[loop:torbscript] review: the fix round for the merge gate's findings is pushed to PR #210 (
1c95dea, review re-requested), CI is running, next: waiting (merge gate review on PR #210)RingList,ConsStack,BankersQueue,Heap(C7) #139