2cl (pronounce "toccle") is a functional programming extension for C++
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#include "2CL.hpp"
|
|
#include <assert.h>
|
|
|
|
struct test_001{
|
|
test_001()
|
|
{
|
|
auto fn = cl::compose(
|
|
[](int a)->int{return a+2;},
|
|
[](int a)->int{return a*2;}
|
|
);
|
|
assert(fn(1)()==6);
|
|
}
|
|
};
|
|
|
|
test_001 run_001;
|
|
|
|
struct test_002{
|
|
test_002()
|
|
{
|
|
using namespace cl;
|
|
auto fn =
|
|
[](int a)->int{return a+2;}
|
|
* [](int a)->int{return a*2;};
|
|
assert(fn(2)()==8);
|
|
}
|
|
};
|
|
|
|
test_002 run_002;
|