Can you do Functional Programming in any language? More importantly, can you learn FP in any language? What does it mean to call a language “functional”?
Thoughts on Functional Programming Podcast
An off-the-cuff stream of Functional Programming ideas, skills, patterns, and news from Functional Programming expert Eric Normand.
In Functional Programming, everything needs to be first class? But what does that mean? And why is it important? I discuss the idea of composing Actions and Calculations dynamically.
We have so much memory now, compared to the 1970s, that it often seems like we have memory to burn. I misspoke in a previous episode where I made it seem like I’m in favor of wasting memory. But what did I mean instead?
As I develop and expound this theory, it may seem to be too complicated. Isn’t functional programming just programming with pure functions? Why make this more complicated than that? We talk about my reasons and my goals for the theory.
If I write a straightforward solution to a problem in Clojure, it might take me a thousand lines of code to solve it. To handle all the corner cases and everything, I got a thousand lines of code. However, if I take this other approach where it’s much more indirect, or instead of solving the problem that I have in front of me, I write a language–a DSL. The DSL could take me 500 lines of code to write. That’s a fairly large DSL. Usually they’re much smaller, but it takes me 500 lines of code. Actually, writing the solution in it only takes 10 lines of code.
In school, we learn about a few algebraic properties. These apply very well in functional programming because their expression is so simple, their definitions are so simple and they really focus on how things compose.
I think the real trick to all of that is always think about the data as being forever. One thing that we often do when we’re programming is we want things to be a little bit more concrete.
One of the questions that came up a couple times was what is a Web framework? What does that even mean? I don’t want to get into philosophical discussion about what a framework is. Is it a library or framework or any of those kinds of questions. I’ll tell you what I meant, what I still mean by this assertion that we need one.
What I want to talk about is this issue of what is an action and what is a calculation in terms of timeliness, because we know that deep down in the computer, everything is an action. Every operation depends on what is that particular locations in memory at the time that the operation is run.