When I was a teenager, I hardly found anything cooler than the Y-combinator.
The Y-combinator is a mathematical construct in lambda calculus. You all know what a function is, right? Well, Alonzo Church came up with λ-calculus as an attempt to create a foundation for math starting from the simple concept of function. Instead, he ended up with a model for computation analogous to the more popular turing machine.
Now I don't want to get in too deep, but let me at least try explain what the Y-combinator does in brief.
In lambda calculus all functions are anonymous. This means that you cannot define a recursive function by making it call itself by name. So, to achieve recursion you need to pass the function to itself as an argument that it can then call. This is done by the Y-combinator function, that takes a function and returns the function called on the Y-combinator called on the function.
So, Y(g) = g(Y(g)) = g(g(Y(g))) = g(g(g(Y(g))))
See the recursion?
The Y combinator is defined as follows:
Y = λ f.(λ x.f(x x)) (λ x.f (x x))
Don't get it? Here's an actual explanation:
https://mvanier.livejournal.com/2897.htmlTo the teen me, this DEPTH of concepts was inspiring and COOL... and I guess gurren lagann was cool too...