#include #include #include "prelude.h" using namespace fcpp; using std::cout; using std::endl; bool prime( int x ) { if( x<2 ) return false; for( int i=2; i 100; } int main() { using fcpp::plus; using fcpp::minus; Fun1 f = makeFun1( ptr_to_fun(&prime) ); assert( f(11) == true ); f = makeFun1( ptr_to_fun(&big) ); assert( f(11) == false ); Fun2 g = makeFun2( monomorphize2( plus ) ); assert( g(3,2) == 5 ); g = minus; // makeFun2 and monomorphize2 can be implicit assert( g(3,2) == 1 ); cout << "ok" << endl; }