|
|
|
|
|
by Jtsummers
1345 days ago
|
|
They seem to mean a computational block (or a closure/lambda) that can be passed on to other functions. Try to do this in C (it's invalid as presented, but this is the concept): int main() {
int* collection = ...
int* filtered = filter(collection, int func(int item) { return item > 10; });
...
}
You have to actually define a function at the top level in order to pass that in and there is no notion of closures so you can't do the more useful thing that you might have in even C++ these days: int main() {
int* collection = ...
int limit = ...
auto filter = [&limit](auto item) { return item > limit; };
int* filtered = filter(collection, filter); // assuming `filter` is defined
...
}
You can come close, but you create a lot of extra bookkeeping in your C program to pull it off, and the functions are still only defined at the top-level. |
|
Not as nice as anonymous blocks but helps put the function closer to where it's used, which is nice.