query
On this page

converge

lib.fixedPoints.converge

Docs pulled from | This Revision | 14 minutes ago


Return the fixpoint that f converges to when called iteratively, starting with the input x.

nix-repl> converge (x: x / 2) 16
0

Inputs

f

1. Function argument

x

2. Function argument

Type

(a -> a) -> a -> a

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

converge =
    f: x:
    let
      x' = f x;
    in
    if x' == x then x else converge f x';