Boost logo

Boost :

From: Oscar Fuentes (ofv_at_[hidden])
Date: 2002-02-07 08:07:18


Jaakko Jarvi <jajarvi_at_[hidden]> writes:

> Hi,
>
> I've been working on the Lambda Library recently, and hope to be able to
> submit it soon.

That's great news!
 
> Those interested can check out the branch: lambda_development and take a
> look.
> Unlike the old version in the files section, the current version uses
> (I hope) only standard C++.
> The tests have been compiled and run with gcc 3.0.2 and KCC with edg 2.43
> frontend.

Well, I was unable to compile with gcc 3.0.3 (cygwin) and 2.95.3
(mingw). All test I've tried gave the same errors:

In file included from t:/boost/boost/lambda/core.hpp:35,
                 from t:/boost/boost/lambda/bind.hpp:20,
                 from bind_tests_simple.cpp:6:
t:/boost/boost/lambda/detail/actions.hpp:180: parse error before `,'
In file included from t:/boost/boost/lambda/core.hpp:40,
                 from t:/boost/boost/lambda/bind.hpp:20,
                 from bind_tests_simple.cpp:6:
t:/boost/boost/lambda/detail/function_adaptors.hpp:550: parse error before `,'

...

The offending line in actions.hpp is

  BOOST_STATIC_CONSTANT(bool, value =
  (boost::is_base_and_derived<protectable, T>::value));

I'm using boost v 1.26.0. Do I need the current CVS sources?

> gcc 2.96 does not handle all features (two test files fail).
>
> The documentation is still a draft, but is improving on daily basis.
> Some parts are not yet documented. The test files in libs/lambda/test
> document all the features of the library.

Just a few nits:

3.2.1

" ... the lambda expression _1 + 1 can be seen as syntactic sugar
for the pseudo code bind(operator+, _1, 1). "

Should be "... the lambda expression 1 + _1 ...". This way the order
of arguments is the same for both expressions. Note that you later
define an asymmetric operator+ in another example.

//---------

4.1

"for_each(v.begin(), v.end(), _1 = bind(foo, _1));"

'for_each' is a non-mutating algorithm. 'transform' is better for this
case.

//-----------

4.3

The first line below is superfluous, the 'make_const' example does not
use 'i' nor 'j':

"
int i = 1; int j = 2;
(_1 + _2)(make_const(1), make_const(2)); // ok
"
 
> Feedback is very much appreciated.

Well, from a Functional Programming enthusiast:

(1) Having recursion would be great.

(2) Having some kind of 'let' form would make an almost complete
lambda facility so I wouldn't miss too much Scheme or Haskell (except
for the syntax ;-)

A facility for (2) would possibilitate (1), I think.

I can't see why the above can't be done. How much complex is to
implement it on the current code, I dont' know :-)

And just as a personal comment: I wonder why this library hasn't more
attention.

-- 
Oscar

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk