C++ lambda. You can basically do this:
auto succ = [](int i) { return i + 1; };
To make variables in the surrounding scope visible (i.e., create a closure) you have to specify that they're available and how. Grabbing a reference to all variables in scope you could do:
int x = 0;
auto inc_x = [&] () { return x++; };
This makes x available via reference so it can be modified. If you just want the value:
int x = 0;
auto always_one = [=] () { return x + 1; };
And you can constrain which variables are visible within the lambda:
int x,y;
auto foo = [&x] (auto n) { x += n; };
The return type can be determined by the compiler, or they can be made explicit (I chose not to). The first examples all returned integers, the last one has void return type.