#pragma once
|
|
#include "combinations/tuple.hpp"
|
|
|
|
namespace cl{
|
|
struct sigil_t{
|
|
constexpr sigil_t(){}
|
|
};
|
|
sigil_t sigil;
|
|
|
|
template<typename a, typename ...c>
|
|
class compose{
|
|
// f . next
|
|
a f;
|
|
compose<c...> next;
|
|
public:
|
|
compose(a fn1, c ...oth)
|
|
: f{fn1}
|
|
, next{oth...}
|
|
{}
|
|
template<typename ...t>
|
|
auto operator()(t ...Args){
|
|
return next(f(Args...));
|
|
}
|
|
|
|
};
|
|
|
|
template<typename a>
|
|
class compose<a>{
|
|
// f . g
|
|
a f;
|
|
public:
|
|
compose(a fn1)
|
|
: f{fn1}
|
|
{}
|
|
template<typename ...t>
|
|
auto operator()(t ...Args){
|
|
return f(Args...);
|
|
}
|
|
|
|
};
|
|
|
|
template<typename a, typename b>
|
|
auto operator*(a fn1, b fn2)
|
|
{
|
|
return compose(fn1, fn2);
|
|
}
|
|
}
|