Boost logo

Boost :

Subject: Re: [boost] De Bruijn Bind (alternate bind syntax) Interest?
From: David Sankel (camior_at_[hidden])
Date: 2010-09-07 21:40:41


On Tue, Sep 7, 2010 at 3:42 PM, Larry Evans <cppljevans_at_[hidden]>wrote:

> On 09/07/10 10:41, David Sankel wrote:
> > On Sun, Sep 5, 2010 at 7:56 PM, Larry Evans <cppljevans_at_[hidden]
> >wrote:
> [snip]
> >> However, compiling my first try( the attached) gives:
> [snip]
> >> What am I doing wrong?
> >>
> >
> > int result = app( next, 1 );
> >
> > With the reference implementation, app should always be used within a
> lam.
> > In this case you don't need a lam:
> >
> > int result = next( 1 ).
> >
> > But if you really wanted to make a nullary function (note the extra '()'
> at
> > the end):
> >
> > int result = lam<0>( app( next, 1 ) )();
> >
> > Looking at the subsequent expression:
> >
> > int result = app(lam_app,1);
> >
> > Again we can apply the function directly here:
> >
> > int result = lam_app(1);
> >
> > Does that help?
>
> I tried `lam_app(1)` in the following main:
>
> [CODE "apply_apply.cpp"]
> int main()
> {
> auto op = lam<1>( app(next,_1_1 ) );
> int op_1 = op(1);
> auto lam_app = lam<1>( app(op,_1_1) );
> int lam_app_1 =
> #if 1
> lam_app(1);
> #else
> 2;
> #endif
> return op_1 + lam_app_1;
> }
> [/CODE "apply_apply.cpp"]
>
> However, this resulted in:
>
> [COMPILE_ERRORS "apply_apply.cpp"]
> [/COMPILE_ERRORS "apply_apply.cpp"]
>
> and the errors go on for about 40 more lines.
>
> Any ideas?
>

Hrm, it works for me. I wonder if you're using an older version. I've added
your example to the repository's main.cpp. Are you able to compile the
repository's version?

-David

-- 
David Sankel
Sankel Software
www.sankelsoftware.com
585 617 4748 (Office)

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