On 20.05.2016 02:50,
gdo...@gmail.com wrote:
> What are Lambda(s)? and Why use them?
A lambda expression creates and calls an instance of an automatically
generated class that has an operator(). So it's like an anonymous
function defined on the spot. The generated class can capture values and
references from the context, but by default it doesn't.
The name “lambda” is commonly used for anonymous functions in
programming, regardless of the programming language, and stems no doubt
from Church's ¹“lambda calculus” that the Lisp language was based on.
For details of the C++ lambda see the discussion over at ²
cppreference.com.
× × ×
Instead of asking simple factual questions in clc++, better ask them
over at Stack Overflow.
Stack Overflow is Q&A site, catering to that kind of question.
clc++ is a discussion group, and there isn't much discussion in a simple
factual question unless someone posts a horribly wrong answer and
insists it is correct.
× × ×
Questions that can be discussed are however better asked here than on
SO. That's because SO is actively designed to not discourage
discussions. For example, one can't post formatted code in SO comments,
and SO moderators regularly tidy up discussion threads with often less
than perfect value judgment, or even recognition of what constitutes
necessary context for the comments left behind.
Cheers & hth.,
- Alf
¹ <url:
https://en.wikipedia.org/wiki/Lambda_calculus>
² <url:
http://en.cppreference.com/w/cpp/language/lambda>