def clamp_ok

bend-collections-laws-math@1.0.0.0 · src/math/natural.bend:340

import bend-collections-laws-math@1.0.0.0/src/math/natural.bend as Natural
import Base

340def clamp_ok(+x: Nat, +lo: Nat, +hi: Nat, +bad: Bool) -> Result<&2, &2, MathError, Nat>:
341  match bad:
342    case True{}:
343      Fail{Domain{}}
344    case False{}:
345      Done{Nat.min(Nat.max(x, lo), hi)}

Uses (6)

Used by (8)