cft

Functional Programming is AWESOME

Here are some programming languages that are really interesting to learn.


user

Emmett Boudreau

3 years ago | 4 min read

A programming paradigm is a term used to describe methods for writing commands. The very idea of a language is built off of its programming paradigm. Among the most well-known three paradigms are object-oriented programming, imperative programming, and functional programming. No one ideology is better than the other, as typically it's more about using the right tool for the job.

Functional Programming is a concept that most software engineers are at least vaguely familiar with. The second programming language ever written to program computers, Lisp, was actually well within the functional paradigm. Functional programming is, by simplified definition programming that takes immutability and mathematical computation with data into priority, rather than traditionally modifying parts of objects stored within class constructors. With modern functional programming, this idea is a tad-bit stretched, which isn’t necessarily a bad thing. Mutability in functional languages has brought with it a lot more utility and dare I say it:

Functionality

to functional programming. With that in mind, functional programming is not limited to functional language. Python, for instance, has functional features. And though traditionally, functional programming has been incredibly different, it seems the functional and object-oriented paradigm closes a bit with most languages used for Data Science.

Great For What We Do

Most functional languages have “ statistical” in the title. That’s convenient because a data scientist is a lot like a statistician, just with programming and machine-learning skills tacked on. Functional languages can often be faster, and most of all easier for a data scientist.

Trust me on this, you don’t want to be skimming through C code because your accuracy is a little low. Most functional languages are perfectly read-able, and are pretty easy to type and get the hang of. It might be a surprise for some to learn that functional programming is a base for many of the internet’s oldest big data pipelines. Functional programming has actually become increasingly more popular recently with the rise of machine-learning and statistical computing.

Cool Languages

There are a lot of cool statistical languages, many of them having stew pots of their own features intertwined with other more traditional features. There are a lot of cool languages that I’m a big fan of under the functional programming language.

Julia

Julia is easily my favorite language of all time. Though Julia certainly is functional, it does contain some mutable and object-oriented-like properties that make it a little more convenient to program in. Julia is incredibly fast for being such a high-level language. It's easy to type, and when typed well it can be as fast as C while simultaneously being easier to read than R and Scala. Typically, it doesn’t take all that long to get a model up and trained in Julia, and this adds to the benefits of using Julia, as the language is easy, and the ML is quick. In some cases, like in my ML package, Lathe, machine learning can be done in fewer lines, and properties of constructors can be mutated even more easily with parametric polymorphism.

Lisp

Though Lisp isn’t necessarily known for its data-science domain, it’s still a really cool language. Lisp, like Julia, makes programming really easy and convenient. One property that is really notable is Lisp’s macros and Julia’s macros. Macros themselves are a mostly functional features, and can make notebook coding really easy when used correctly. It should be noted that Lisp has segmented itself into a diverse set of languages including Scheme, Clojure, and (Common) Lisp. It is hard to fathom or estimate the impact of the second high-level language and its functionality, but the scope definitely is quite large.

R

And now we greet our good old friend, R. R is traditionally a functional language, but like most others is (or has become) multi-paradigm, meaning it picks and chooses what it likes from each particular programming paradigms. This is great because it gives R the advantage of mutability. R holds origins in the S language, and has always been focused on statistical computing.

Haskell

Haskell is a different cup of tea entirely from the multi-paradigm languages I talked about above in that Haskell prides itself in being purely functional. I can’t speak for Haskell, as unlike the other languages on this list, I’ve never used it. But from what I’ve heard, Haskell is certainly a cool language. My concern with learning Haskell would be purely limitation. As I discussed, most modern languages are multi-paradigm, which allows them to effectively squash any bugs they need to squash without creating a new code-base.

Final Thoughts

I spend most of my time inside of functional languages, mostly Julia, as illustrated by notebook repository on Github containing mostly Julia notebooks. I love functional programming because for what I do, it fits the bill incredibly well. There certainly are some times when Python constructors (classes) might have been better for a particular job, but overall, Julia gets the job done, and the way it's typed is very fluid and efficient to me. For others, it's possible that functional languages are unable to accomplish their goals, and it can be difficult to learn for someone that’s worked with object-oriented languages their whole life. At the end of the day, language is a choice, most languages have developers, and most languages have advantages and disadvantages.

Upvote


user
Created by

Emmett Boudreau


people
Post

Upvote

Downvote

Comment

Bookmark

Share


Related Articles