Posts Tagged 'cplusplus'

Soup Of Punctuation

Herb Sutter filed this entry earlier this month providing a summary of the March ISO C++ Standards meeting. One of the new features added to C++0X is lambda functions and closures.

So, in his entry, Herb provides an iteration example of writing a collection of objects to the console using a lambda function:

for_each( w.begin(), w.end(),
[]( const Widget& w ) { cout << w << " "; });

And an example of using the std::transform algorithm:

transform( v.begin(), v.end(), output.begin(), []( const Widget& w ) -> AnotherType
return SomeResultCalculatedFrom( w );
} );


I love that fact that one of the main criticisms of Lisp is that there are too many parentheses. After looking at these examples, it seems like C++ and other languages wishes to be Lisp, but are cursed with their own soup of punctuation. It’ll be some time before this C++ syntax sticks, so I’ll just stay on the fence (still hacking Lisp) to see what happens.