My omnium-gatherom of scripts and source code.
at main 38 lines 888 B view raw
1#include <tuple> 2namespace combinators 3{ 4 /* \xyz.x(yz) */ 5 auto b = [](auto x, auto y, auto z){ return x(y(z)); }; 6 7 /* \xyz.xzy */ 8 auto c = [](auto x, auto y, auto z){ return x(z, y); }; 9 10 /* \abc.cba */ 11 auto f = [](auto a, auto b, auto c){ return c(b, a); }; 12 13 /* \a.a */ 14 auto i = [](auto i){ return i; }; 15 16 /* \abc.ac(bc) */ 17 auto s = [](auto a, auto b, auto c){ return a(c, b(c)); }; 18 19 /* \xy.x */ 20 auto k = [](auto x, auto y){ return x; }; 21 22 /* \xy.xyy */ 23 auto w = [](auto x, auto y){ return x(y, y); }; 24 25 namespace functions { 26 auto _eq_ = [](auto x, auto y){ return x == y; }; 27 28 auto eq_ = [](auto x){ return [x](auto y){ return x == y; }; }; 29 30 auto _add_ = [](auto x, auto y){ return x + y; }; 31 32 auto add_ = [](auto x){ return [x](auto y){ return x + y; }; }; 33 34 auto fst_ = [](auto x){ return std::get<0>(x); }; 35 auto snd_ = [](auto x){ return std::get<1>(x); }; 36 } 37 38}