until


until(p, fn, x) 
      

Apply the function fn to x and pass the result r to the predicate p. If p return true, r is returned, otherwise pass r to a recursive call to until.

Return the final value of applying the function fn to x.

Examples:


until(is_prime, partial(`+`, 1), 1000)
// 1009
      

Also see:

do_times
callcc


Core Module Index | Contents