Why yes . . . .

Joel on Software

“Many older languages simply had no way to do this kind of stuff. Other languages let you do it, but it’s hard (for example, C has function pointers, but you have to declare and define the function somewhere else). Object-oriented programming languages aren’t completely convinced that you should be allowed to do anything with functions.”
. . . . mine can, and it is one of the granddaddies – c++

#include <algorithm>
#include <boost/lambda.hpp>
#include <boost/assign.hpp>

using namespace boost::lambda;
using namespace boost::assign;

vector<string> a = list_of(“hi”)(“there”);
for_each(a.begin(), a.end(), std::cout << _1 << ‘ ‘);

which starts to look awfully like a p language, hmmm . . .

#!/usr/bin/perl

use strict;

my @a = qw (hi there);
map { print $_.’ ‘; } @a;

check out boost::lambda, boost::assign and boost::function

And they say that C++ is verbose! ;)

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.