def clamp_ok
import bend-collections-laws-math@1.0.0.0/src/math/natural.bend as Naturalimport 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)
- bend-collections-laws-math@1.0.0.0/src/math/natural:clamp
- bend-collections-laws-math@1.0.0.0/proofs/math/natural/misc:clamp_domain
- bend-collections-laws-math@1.0.0.0/proofs/math/natural/misc:clamp_done
- bend-collections-laws-math@1.0.0.0/proofs/math/typed/u32:clamp_c
- bend-collections-laws-math@1.0.0.0/proofs/math/typed/u32int:clamp_c
- …