Survival.count_raw.go: def of unified-nsga-iii@0.2.2.0 Import: import unified-nsga-iii@0.2.2.0/survival.bend as Survival Lines 300-315 of unified-nsga-iii@0.2.2.0/survival.bend: https://jend.leeeet.dev/read.txt?path=unified-nsga-iii@0.2.2.0/survival.bend&start_line=300&end_line=315 import Base import unified-nsga-iii@0.2.2.0/util.bend as Util # Histogram increments commute. Mid-split asgs, then add count vectors. def count_raw.go(+n: Nat, +fuel: Nat, asgs: List<&2, Assignment>) -> List<&2, Nat>: match fuel asgs: case 0n Nil{}: Util.zeros_nat(n) case 0n a <> rest: Util.inc_at(count_raw.go(n, 0n, rest), asg_ref(a)) case 1n+p Nil{}: Util.zeros_nat(n) case 1n+p a <> Nil{}: Util.inc_at(Util.zeros_nat(n), asg_ref(a)) case 1n+p h <> t: +all = {h <> t : List<&2, Assignment>} +mid = Nat.div(Util.list_len(Assignment, all), 2n) lo hi = count_raw.go(n, p, List.take(&2, Assignment, all, mid)) count_raw.go(n, p, List.drop(&2, Assignment, all, mid)) Util.nats_add(lo, hi) Uses (11): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.drop https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.take https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.div https://jend.leeeet.dev/definition.txt?path=unified-nsga-iii@0.2.2.0/survival.bend&name=Assignment https://jend.leeeet.dev/definition.txt?path=unified-nsga-iii@0.2.2.0/survival.bend&name=asg_ref https://jend.leeeet.dev/definition.txt?path=unified-nsga-iii@0.2.2.0/util.bend&name=inc_at https://jend.leeeet.dev/definition.txt?path=unified-nsga-iii@0.2.2.0/util.bend&name=list_len https://jend.leeeet.dev/definition.txt?path=unified-nsga-iii@0.2.2.0/util.bend&name=nats_add https://jend.leeeet.dev/definition.txt?path=unified-nsga-iii@0.2.2.0/util.bend&name=zeros_nat