I have no formal functional programming training but being curious I’ve always paid attention to it.
Lately I was designing an API for a Perl module I’m about to release. I wanted to share how elegant the functional approach is compared to an iterative one.
The context: I’m building a module that implements a very weak cipher where each character of a string is rotated according to a formula that I wanted the user to control.
A naive approach would look like: