
Peter Dimov wrote:
Kirit Sælensminde:
template< typename R, typename V1, typename V2 > boost::function< boost::function< R ( V1 ) > ( V2 ) > curry( boost::function< R ( V1, V2 ) > f ) { return boost::bind( papply< R, V1, V2 >, f, _1 ); }
...
boost::function< boost::function< int ( int ) > ( boost::function< int ( int, int ) >, int ) > fpapply( papply< int, int, int > );
...
//curry( fpapply );
Terrific.
As in inducing terror? :)
It seems that fpapply is of the form function
(V2,V3), and curry wants function (V2).
The argument to curry is a binary function of this form: boost::function< R ( V1, V2 ) > fpapply is of this type: boost::function< boost::function< int ( int ) > ( // curry's R boost::function< int( int, int ) >, // curry's V1 int ) > // curry's V2 papply itself is this: boost::function< R ( V2 ) > papply( // curry's R boost::function< R ( V1, V2 ) > f, // curry's V1 V1 v ) // curry's V2 These are in the same form, it's just that V1 is now a function rather than a value. To me it looks like I should be able to pass this in as the binary function to curry. K