def pick_ix
mylsm-lsm-store@0.3.2.0 · src/Sstable.bend:468
import mylsm-lsm-store@0.3.2.0/src/Sstable.bend as Sstable
import Base
import mylsm-lsm-store@0.3.2.0/src/Keys.bend as Keys
import mylsm-lsm-store@0.3.2.0/src/MemTable.bend as MemTable
468
469
470
471def pick_ix(bt: List<&2, String>, ct: List<&2, List<&2, MemTable.Entry>>, ix: Nat, +key: String, order: Cmp) -> Nat:
472 match bt ct order:
473 case _ _ GT{}:
474 Nat.sub(ix, 1n)
475 case Nil{} _ _:
476 ix
477 case _ Nil{} _:
478 ix
479 case Con{b2, bt2} Con{d2, ct2} LT{}:
480 pick_ix(bt2, ct2, Nat.add(ix, 1n), key, Keys.cmp(b2, key))
481 case Con{b2, bt2} Con{d2, ct2} EQ{}:
482 ix