ByteMemTable.retained_bytes.keep.go: def of mylsm-lsm-store@0.6.0.1 Import: import mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend as ByteMemTable Lines 477-498 of mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend: https://jend.leeeet.dev/read.txt?path=mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend&start_line=477&end_line=498 import Base import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes def retained_bytes.keep.go( entries: List<&1, Entry>, reversed: List<&1, Entry>, total: Nat ) -> List<&1, Entry> & Nat: match entries: case Nil{}: (List.reverse(&1, Entry, reversed), total) case Con{Entry{key, value}, tail}: match key: case Bytes.Bytes{+key_len, key_buffer}: match value: case None{}: retained_bytes.keep.go(tail, Con{Entry{Bytes.Bytes{key_len, key_buffer}, None{}}, reversed}, Nat.add(total, Nat.add(32n, U32.to_nat(key_len)))) case Some{Bytes.Bytes{+value_len, value_buffer}}: retained_bytes.keep.go(tail, Con{Entry{Bytes.Bytes{key_len, key_buffer}, Some{Bytes.Bytes{value_len, value_buffer}}}, reversed}, Nat.add(total, Nat.add(Nat.add(32n, U32.to_nat(key_len)), U32.to_nat(value_len)))) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.reverse https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add 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=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=Bytes https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend&name=Entry