def pick_ix
mylsm-lsm-store@0.6.0.1 · src/Sstable.bend:446
import mylsm-lsm-store@0.6.0.1/src/Sstable.bend as Sstable
import Base
import mylsm-lsm-store@0.6.0.1/src/Keys.bend as Keys
import mylsm-lsm-store@0.6.0.1/src/MemTable.bend as MemTable
446
447
448
449def pick_ix(bt: List<&2, String>, ct: List<&2, List<&2, MemTable.Entry>>, ix: Nat, +key: String, order: Cmp) -> Nat:
450 match bt ct order:
451 case _ _ GT{}:
452 Nat.sub(ix, 1n)
453 case Nil{} _ _:
454 ix
455 case _ Nil{} _:
456 ix
457 case Con{b2, bt2} Con{d2, ct2} LT{}:
458 pick_ix(bt2, ct2, Nat.add(ix, 1n), key, Keys.cmp(b2, key))
459 case Con{b2, bt2} Con{d2, ct2} EQ{}:
460 ix