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.
|
#pragma once
|
|
#include "combinations/curry.hpp"
|
|
|
|
namespace cl
|
|
{
|
|
template <typename a>
|
|
class function{
|
|
a me;
|
|
public:
|
|
function(a value)
|
|
: me(value)
|
|
{}
|
|
template<typename ...b>
|
|
auto operator()(b ...Args){
|
|
return me(Args...);
|
|
}
|
|
template<typename cur, typename ...b>
|
|
auto operator()(cur arg){
|
|
return curry(arg, me);
|
|
}
|
|
};
|
|
|
|
template<typename invokable, typename ret, typename ...Args>
|
|
ret invoke(invokable fn, Args ...args)
|
|
{
|
|
return fn(args...);
|
|
}
|
|
}
|