Boost logo

Boost :

Subject: Re: [boost] De Bruijn Bind (alternate bind syntax) Interest?
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-09-03 07:22:25


David Sankel wrote:
> On Thu, Sep 2, 2010 at 3:41 PM, David Sankel <camior_at_[hidden]> wrote:
> > On Thu, Sep 2, 2010 at 3:21 PM, Dave Abrahams wrote:
>
> >> and how is _1 different from arg<0>?
> >
> > I'm not sure what you mean here. var (or arg if you like)
> > in this library takes two template arguments.
>
> Maybe you're thinking that _1 seems similar to arg<0,0> which
> is true until abstractions (lambdas/binds) get nested.

Shorthand is helpful, so perhaps you could use _1_1, _1_2, _2_1, etc. (I skipped zero because you were figuring on switching to one-based indexing.)

_1_1 is more readable and succinct than arg<1,1>:

   auto const_ = lam<1>( lam<1>( arg<2,1>() ) );

   auto const_ = lam<1>( lam<1>( _2_1() ) );

and:

   auto flip = lam<1>( lam<2>( app( arg<2,1>()
                                  , arg<1,2>()
                                  , arg<1,1>()
                                  )
                             )
                     );

   auto flip =
      lam<1>(lam<2>(app(_2_1(), _1_2(), _1_1())));

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


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