def runs.at

gralha-coverage@0.1.0.1 · cover.bend:36

import gralha-coverage@0.1.0.1/cover.bend as Cover
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U

36# Coverage of a cell from rows of runs; a slow path for masks built without a tree.
37def runs.at(rs: List<&2, Run>, +x: U32) -> F32:
38  match rs:
39    case Nil{}: 0.0
40    case Con{Run{a, b, v}, rest}:
41      +aa = a
42      +bb = b
43      +vv = v
44      U.choose(F32, U32.is_ge(x, aa) && U32.is_lt(x, bb), vv, runs.at(rest, x))

Uses (8)

Used by (1)