Delayed evaluation of expressions
Marko Rauhamaa
marko at pacujo.net
Wed Mar 26 18:45:19 EDT 2014
Chris Angelico <rosuav at gmail.com>:
> You prove here that Python has first-class expressions in the same way
> that 80x86 assembly language has garbage collection. Sure, you can
> implement it using the primitives you have, but that's not support.
I was more reminded of STL and Boost. For example:
std::for_each(v.begin(), v.end(),
(
switch_statement(
_1,
case_statement<0>(std::cout << constant("zero")),
case_statement<1>(std::cout << constant("one")),
default_statement(cout << constant("other: ") << _1)
),
cout << constant("\n")
)
);
(<URL: http://www.boost.org/doc/libs/1_55_0/doc/html/lambda/
le_in_details.html#lambda.switch_statement>)
Marko
More information about the Python-list
mailing list