Bytes.huff.counts: def of gralha-bytes@0.1.0.1 Import: import gralha-bytes@0.1.0.1/bytes.bend as Bytes Lines 160-165 of gralha-bytes@0.1.0.1/bytes.bend: https://jend.leeeet.dev/read.txt?path=gralha-bytes@0.1.0.1/bytes.bend&start_line=160&end_line=165 import Base import gralha-text-scan@0.1.0.1/scan.bend as U def huff.counts(n: Nat, +lengths: Bytes, +index: U32, +counts: Bytes) -> Bytes: match n: case 0n: counts case 1n+d: +len = bytes.get(lengths, index) huff.counts(d, lengths, U32.inc(index), U.choose(Bytes, U32.is_gt(len, 0) && U32.is_le(len, 15), bytes.set(counts, len, U32.inc(bytes.get(counts, len))), counts)) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.inc https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_gt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_le https://jend.leeeet.dev/definition.txt?path=gralha-bytes@0.1.0.1/bytes.bend&name=Bytes https://jend.leeeet.dev/definition.txt?path=gralha-bytes@0.1.0.1/bytes.bend&name=bytes.get https://jend.leeeet.dev/definition.txt?path=gralha-bytes@0.1.0.1/bytes.bend&name=bytes.set https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=choose