Boost logo

Boost :

Subject: Re: [boost] Interest in a list comprehension library?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2010-12-19 20:54:55

On 12/19/10 12:40, Brent Spillner wrote:
> I uploaded sample code to the Vault (in the "Miscellaneous/"
> directory) that provides a concise notation for list comprehensions.
> The comprehensions are evaluated lazily and can be used to populate a
> std::list, vector, or deque, appended to the same, inserted after a
> given iterator, or interpreted as a boost::range, including
> compatibility with BOOST_FOREACH. Containers, iterator-defined
> ranges, or nullary function objects can be used as generators, and
> arbitrary function objects can be used to specify filter conditions.

List comprehensions in haskell can be done with monads:

Why not 1st define a c++ monad and then define the list comprehension
using the moand? If that were done, then boost would have both.
Actually, fcpp already has it in monad.h. Fcpp is available at sourceforge:

However, I've not used fcpp and several years ago boost reviewed it
but decided not to include it.

However, I think defining a monad acceptable to boost would be
useful since it is used extensively in functional programming.


Boost list run by bdawes at, gregod at, cpdaniel at, john at