def within

lawful-fields@0.1.1.0 · defs.bend:103

import lawful-fields@0.1.1.0/defs.bend as Defs
import Base

103# Every offset in es lies in from .. to.
104def within(es: List<&2, U32>, +from: Nat, +to: Nat) -> Bool:
105  match es:
106    case Nil{}:
107      True{}
108    case Con{+e, t}:
109      (Nat.is_le(from, U32.to_nat(e)) && Nat.is_le(U32.to_nat(e), to)) && within(t, from, to)

Uses (7)

Used by (4)