First, Some Mathematics

As I told readers in the Preface of my red book, my father is an engineer and land surveyor. His profession, before retirement, might imply that he knows a thing or two about mathematics, but in case it doesn’t mean that to you, he does. So what?

This morning I took my dad to the VA clinic and then out for breakfast. As he often does, he started talking about mathematics. Frankly, sometimes my eyes gloss over and I just go into the mode of repetitive agreement. In bringing up mathematics, he’s talking about a subject that he cares deeply about. At 82, and now closing in on 83, I am happy that he is still excited about anything at all. He had quadruple bypass heart surgery more than 12 years ago, and since then a major brain tumor had to be removed, with two follow-up cyber knife procedures. So I listen, as best I can.

When I mentioned that I took my father to the VA clinic, you are probably thinking… And, yes, that’s correct. I have recently learned things about my father’s service in the Korean War, which he has never before opened up about. I knew he was in the armed forces during that war, but I thought he spent all his time in Europe. Not so, and yet getting the details is still a work in progress. So that you understand the times he lived in then, his US Air Force recruiter lied about my father’s age on his application since my dad was two years too young to join. The draft age at the time was 18.5 years, which means my father was at most 16.5 years old when he joined. My son is slightly older than that, and I can’t even image. Full stop.

This is a photo of my father at age 12 or 13. He was in the Korean War just three to four years after this photo was taken. He was too young to make such a decision on his own, but he was born into a military family and it seemed right to him. He hasn’t thought that way since his active duty ended in the mid 1950s, and he raised me to have a completely different view of war and conflict. My dad started on his path to learning mathematics when he exited the Air Force, attending night school.

Today when my father started into his mathematics spiel, I did something different. Since I’ve been wrestling with a deep understanding of functional programming, and since a certain individual keeps telling me that I need to forget what von Neumann did to software engineering, I decided to ask my dad a few questions. So here goes. “Do you know what a function is?” My dad replied, “of course I know what a function is.” I asked him to describe it. He didn’t hesitate for a moment, and stated succinctly, “it’s the way you run an operation on the elements of a set.” I am now stunned. I keep asking, he keeps answering: Functors? Check. Sets? Check. And so on.

I won’t bother to tell you how stupid I felt at that moment for not, over the past several years, asking my dad for input on math as it relates to functional programming. However, I do know why I didn’t ask before. It’s because even knowing that functional programming is based on mathematics, I didn’t think that it was really, really, really, entirely based on mathematics. I mean, it uses some concepts from math, but, you know, that’s about it. Right?

Some certain individual has been pounding the mantra into my head lately, that functional programming is entirely based on mathematics. This person says that I need to drop everything that I know about von Neumann computing, and just think about math. I am thinking, “nope, not so much.”

I asked another few questions of my dad. Honestly, I don’t remember exactly which question I asked, but my dad replied, “well, that’s a category.” Then me: “so, dad, you understand Category Theory?” My dad replied: “of course I do.” I keep firing questions. He keeps answering, and expounding. I get all shivery. I don’t know why, but it is surprising to me that in his answers I hear familiar things, but they don’t sound just like what I know about functional programming. Yet, I think that’s not a problem, because, I have never before made that strong a connection between the two. If functional programming is really all about mathematics, and my mathematics is at best thoroughly forgotten from three-plus decades ago, it’s not surprising that some things sound different.

Needless to say, my dad is now my mathematics consultant. I told him that it was great to have a real mathematician to talk with. He reminded me that he is not a mathematician, only a student of mathematics. To this I asked if there are any real mathematicians on the planet. He indicated that there are some today who call themselves that. I will just leave that there, but with a lot of miles behind him (and even more kilometers), my father has the right to his viewpoint.

Later today he brought my mom by our house, and he had a stack of books. He had already given me an 800-page mathematics encyclopedia earlier, but I guess he thought that wouldn’t be enough. I got that sinking feeling. You know, that sinking feeling that you get when someone hands you a stack of math books. My dad means well, but there’s no way that I can pour over hundreds and hundreds of pages of calculus and physics books, just for the sake of improving my understanding of functional programming. But I got daring and I turned to the index of one book. There it was, in a book published in 1975, the word “functor” in the index. Math is confirmed.

Next I find a familiar word in the index, so I look it up. Right there on page 80 of the big mathematics encyclopedia I try to parse this definition:

The domain of complex numbers is algebraically closed; this means that every algebraic equation with complex coefficients has at least one solution in this domain.

Obviously. And the eye-glossing moments just keep piling up. At that point my dad rescued me from the big encyclopedia. He handed me a calculus book opened at page 3, and tells me to read this. Excellent, page 3! Baby steps to calculus. Right on, now we are talking! And away we go!

The definition of a function makes use of the idea of a set. A set is a collection of objects—not necessarily material objects—described in such a way that we have no doubt as to whether a particular object does or does not belong to it. A set may be described by listing its elements.

Next we arrive at the definition of a function:

A function is a rule that assigns to each element in a set A one and only one element in a set B.

There is more to come.

 I will be blogging again within the next few days about functions, sets, and other mathematical concepts. I promised you before that I would make this very simple, and I will still do so. Backed by a reinforced understanding of how functional programming is defined by mathematics, I think you will find my next segment even more rewarding than it would have been without my recent tune up.

More to explore

Reactive DDD: Modeling Uncertainty

Domain-Driven Design supports reactive architecture and programming. Still, reactive introduces uncertainty. Back in 2003, the way that Domain-Driven Design was used and

Scroll to Top