flâneur — a map of the web's best reading

Y: The Most Beautiful Idea in Computer Science explained in JavaScript

lucasfcosta.com · 5,574 words · saved by 2 readers

In this post, we will talk about one of the most beautiful ideas in computer science: the Y-Combinator. And no, I’m not talking about the VC firm in Silicon ...

In this post, we will talk about one of the most beautiful ideas in computer science: the Y-Combinator . And no, I'm not talking about the VC firm in Silicon Valley , even though this post will explain why they've got this name. Put in simple terms, the Y-Combinator (also known as the fixed-point combinator) is a way of doing recursion in a language that does not explicitly supports it . Let's say you want to implement a recursive factorial function . In JavaScript, for example, you could simply do this: const factorial = n => n === 0 ? 1 : n * factorial (n - 1 ); But what if you couldn't use

Explore this link on the map →

saved by

related reading