Every now and then, I stumble across a programming language that does something so different that it changes how I think about coding. In this post, I want to share some of my favorite finds.
This is not your grandma’s “functional programming will change the world!” blog post: this list is much more esoteric. I’d wager most readers haven’t heard of the majority of the languages and paradigms below, so I hope you have as much fun learning about these new concepts as I did.
Note: I have only minimal experience with most of the languages below: I find the ideas behind them fascinating, but claim no expertise in them, so please point out any corrections and errors. Also, if you’ve found any new paradigms and ideas not covered here, please share them!
Update: this post hit the front page of r/programming and HN. Thank you for the great feedback! I’ve added some corrections below.
“Here is a list of functional programs applied to real-world tasks. The main criterion for being real-world is that the program was written primarily to perform some task, not primarily to experiment with functional programming. Functional is used in the broad sense that includes both `pure’ programs (no side effects) and `impure’ (some use of side effects). Languages covered include CAML, Clean, Erlang, Haskell, Miranda, Scheme, SML, and others…”
- We don’t have to learn everything up front to start writing programs.
In a pure functional language, you cannot log a variable or read a DOM node without using monads. Here we can cheat a little as we learn to purify our codebase. It’s also easier to get started in this language since it’s mixed paradigm and you can fall back on your current practices while there are gaps in your knowledge.
- The language is fully capable of writing top notch functional code.
bind all over the place lest
this change out from under us, we don’t have classesYet, we have various work arounds for the quirky behavior when the
new keyword is forgotten, private members are only available via closures. To a lot of us, FP feels more natural anyways.
“Elm is an unusual programming language as first one needs to learn to think in a different paradigm (FRP). To me, one of the challenges in such a process was to gain sufficient understanding of how tasks and ports are related to each other.
Part of developing an idea in Elm involves understanding the dataflow of your program. In normal imperative programming (say in Python or Java) one essentially constructs a series of operations to perform (thus “imperative”). Whereas in Elm, you define the dataflow. There is no sequence of logical steps to define, hence the paradigm is fundamentally different.
The architectural abstractions entailed in constructing such a dataflow are: models, actions and view. The model describes the current state of your entire program at any point in time; outside of the model, there is no state and everything is ephemeral. Actions happen to the model. Acting upon a model updates it, resulting in a newer model; this is how your program handles state. Finally, the view defines how to render any model on the screen. For more information, see the Elm architecture tutorial…”
“Heap is one of most important data structure, where the minimum of all elements can always be easily and efficiently retrieved…”
“I’d like to share my experience with functional programming in this article. I feel like I’ve learned more in the past 16 months about computer science and computer systems in general than I have in the past 10 years thanks to my foray into Scala and the world of functional programming. The reason functional programming forces you to learn so much is because it challenges every assumption about writing software that you had. Oftentimes you can’t believe that some common thing can be done in a different way and then—boom!—a functional programming concept introduces a better way to do it and blows you away. So, what happened 16 months ago? I quit my startup and was looking for interesting projects to work on. I happened to get a consulting gig at 2lemetry that later turned into a full-time obsession with functional programming, MQTT brokers, and distributed systems. One of the things that impacted me while working at 2lemetry was exposure to Scala. It felt like whatever ideas I had about writing programs were off and I had to relearn everything from scratch…”
“If there is one highly underrated concept in philosophy today, it is computation. Why is it so important? Because computationalism is the new mechanism. For millennia, philosophers have struggled when they wanted to express or doubt that the universe can be explained in a mechanical way, because it is so difficult to explain what a machine is, and what it is not. The term computation does just this: it defines exactly what machines can do, and what not. If the universe/the mind/the brain/bunnies/God is explicable in a mechanical way, then it is a computer, and vice versa…”
“Several times now I’ve seen the following opinion:
For anything that’s algorithm-oriented or with lots of math, I use functional programming. But if it’s any kind of simulation, an object-oriented solution is much easier…”
“Gilad Bracha explains how to distinguish FP hype from reality and to apply key ideas of FP in non-FP languages, separating the good parts of FP from its unnecessary cultural baggage…”