elegance of functional programming

Functional programming allows you to write concise and elegant code. Mainstream
languages like Ruby and C# support a lot of functional programming paradigms,
and learning them makes you a better programmer. Below is a small example which
demonstrates that: