Remarkable. I need to learn maths! It's clear there's a tight relationship (and I've never personally seen a better example than this code):
>main.cpp
// https://godbolt.org/z/7eh8W5qWf
// build & execute:
// g++ -std=c++20 main.cpp && ./a.out; echo $?
#define λx(...) [](const auto& x) { return __VA_ARGS__; }
auto operator*(auto a, auto b)
{
return [=](auto x) { return b(a(x)); };
};
int main()
{
// f == 144 (fully-optimized to the actual answer, at compile-time)
auto f = λx(x + 1) * λx(x * 3) * λx(x * x);
return f(3);
}