Common.Intervalfind p start beyond returns i with start <= i < beyond and p i or i = beyond if no index in the interval satisfies the predicate p.
fold a f start beyond starts with value a and folds the function f over the interval start..beyond.
fold a f start beyond =
f (beyond - 1) (... (f (start+1) (f start a))) module Monadic (M : Module_types.MONAD) : sig ... end