Boost logo

Boost :

Subject: Re: [boost] painless currying
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2011-08-24 04:41:39


On Wednesday, August 24, 2011 09:48:26 AM Lars Viklund wrote:
> On Tue, Aug 23, 2011 at 03:38:19PM -0400, Eric Niebler wrote:
> > On a lark, I implemented a wrapper that turns any TR1-style function
> > object into a "curryable" function object (attached). Successive
> > function call invocations bind arguments until enough arguments are
> >
> > bound to invoke the wrapped function. With it you can do the following:
> > curryable<std::plus<int> > p;
> > auto curried = p(1);
> > int i = curried(2);
> > assert(i == 3);
> >
> > Is there any interest in such a thing?
>
> For what it's worth, I made a feature request[1] about partial function
> application in Phoenix on the trac a few months ago after discussing it
> with Heller on IRC, but interest seemed mild, probably for lack of an
> investigation of the side effects and the lack of a proof-of-concept
> implementation.

More a lack of time than a lack of interest.

FWIW, the feature described is currently perfectly doable with phoenix right
now. With a combination of lambda, bind and placeholders. Which is,
admittingly, not very elegant to do. A lot of boilerplate for such a seemingly
simple task.

> [1] https://svn.boost.org/trac/boost/ticket/5541


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