satgo1546’s ocean

Any sufficiently primitive magic is indistinguishable from technology.

Call for functional programming

This post was first published on Ŝalenzo.RTFD.io.
This post is also available in 简体中文.

Imagine a programming language where there is nothing like the assignment statement.
Variables become constants. Loops never terminate because their conditions don’t change.
Everything paves the way to determinism. until one moment, when functions nest the calls to themselves.
Code either branch to itself or not — a lot like a loop, eh?
Except that every invocation has a name.

The moment the only is way to loop is to recur, it lights up a path an average programmer has never even dared to touch before.
For performance reasons, obviously. We give up everything for performance.
Yet programmer’s performance is a measure of performance, too.
One starts to think of data rather than registers, numbers rather than bit patterns, lists rather than links.
With the exclusion of mutability, magically abstraction comes into play, so fluently.

Dear reader: today I am not asking you to do every program in a functional style.
But next to a cleared problem or a stuck one alike, please, give immutability a try.