3 ms·
Giving your lambdas names defeats part of their purpose though.
by zelphirkalt 2y ago
Giving your lambdas names defeats part of their purpose though.
- int_19h 2y agoThey have two distinct purposes: anonymous functions, and closures. Those often go together, but there are many scenarios where you only care about the latter, and don't actually need the former. Named lambdas (i.e. lambdas assigned to local consts) covers this case if the language doesn't have dedicated syntax for it.
- knodi123 2y agomaybe one purpose. but it fulfills another purpose- self-documenting code, and a really simple non-nested main body to your function.