2 ms·
> It's "closure" in the mathematical sense, not in the functionnal programming sense. The latter being of course an instance of the former :) Your lambda uses
by piaste 5y ago
> It's "closure" in the mathematical sense, not in the functionnal programming sense.
The latter being of course an instance of the former :) Your lambda uses a reference to a local variable `x`, so go follow it and transitively capture all its references, repeat until you've closed over all such transitions.
let a = // whatever
let b x = a + x;
let f x = x + b x; // closes over b and transitively over a