Batch.partition: def of bend-edit-distance@0.2.2.0 Import: import bend-edit-distance@0.2.2.0/src/Batch.bend as Batch Lines 104-112 of bend-edit-distance@0.2.2.0/src/Batch.bend: https://jend.leeeet.dev/read.txt?path=bend-edit-distance@0.2.2.0/src/Batch.bend&start_line=104&end_line=112 import Base # Largest estimated jobs go to the lighter branch. Capacity bounds keep both # child counts within ceil(n/2), including zero/rounded/equal work estimates. def partition(jobs: List<&2, WeightedJob>, groups: Group & Group) -> Group & Group: match jobs: case Nil{}: groups case job <> tail: (+left, +right) = groups partition(tail, place(job, left, right, choose(left, right))) Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=bend-edit-distance@0.2.2.0/src/Batch.bend&name=Group https://jend.leeeet.dev/definition.txt?path=bend-edit-distance@0.2.2.0/src/Batch.bend&name=WeightedJob https://jend.leeeet.dev/definition.txt?path=bend-edit-distance@0.2.2.0/src/Batch.bend&name=choose https://jend.leeeet.dev/definition.txt?path=bend-edit-distance@0.2.2.0/src/Batch.bend&name=place