NLA-lib Explorer

NLAlib.Ops.whileIter

Library · def

The loop with early exit: at most r more rounds, from the round i. A round applies test (which returns the Boolean and the state after the test); if it holds the round runs body and the loop goes on, otherwise the loop ends. The result is the number of rounds done and the state. At the cap the loop ends without a test.

NLAlib.Ops.whileIter {σ : Type} (test : ℕ → σ → Option (Bool × σ)) (body : ℕ → σ → Option σ) :
  ℕ → ℕ → σ → Option (ℕ × σ)

Full source on GitHub

Import NLAlib.Ops.Exec.