Closure (computer programming)
In this example, the function named gradient makes a closure together with the variables f and dx. The outer enclosing function named derivative returns this closure. In this case, an anonymous function would work also.def derivative(f, dx):