The Completion of 30 Days of Functional Programming

This past week I completed my challenge of spending 30 days diving into functional programming. It was a valuable experience filled to the brim with new or fledgling concepts. Apart from my experience with 100 Days of Code, this was one of my first forays into the increasingly popular concept of #LearnInPublic as well. In this post, I break down some of the structures that were beneficial or not to my learning process, as well as a 50,000 foot overview of the concepts learned along the way. ...

September 5, 2019 · 4 min · Skyler Lemay

Functors and Monads - 30DaysofFP Week 3

Functors and monads may sound like some dark secret ingredient from the recesses of functional programming. For our purposes we will begin to approach them as data types that follow a base set of rules. In this post we will dive into working definitions for functors and monads as well as a working example tying them all together. What is a functor A functor is a type which contains a map function and adheres to several rules. At their core, they are containers which encapsulate a value. The map function reaches into the container, performs an operation on the inner value, and ultimately returns it back to the container. Arrays in JavaScript are actually functors. Surprise! ...

September 3, 2019 · 6 min · Skyler Lemay

What is a Side Effect Anyway? - 30DaysofFP Week 2

Managing side effects is a core principle of functional programming. The existence of side effects can make a program more volatile, error prone, and harder to reason about. In this post, we’ll dive into what side effects (and side causes) are, how to manage them, and functional purity. What is a Side Effect A side effect occurs when a function changes something outside of itself. This could be mutating a global variable, pushing data into an array, tracking application state, and more. An application must have side effects in order to run, or else there would be no feedback that it ran in the first place. Writing to the DOM, emitting a console.log, and making an API call are all side effects. As such they cannot be eliminated entirely. Functional programming seeks to minimize them as much as possible, controlling when and how they occur. ...

August 19, 2019 · 6 min · Skyler Lemay

An intro to Functional Programming - 30DaysofFP Week 1

1.5 weeks ago I set out to learn more about Functional Programming with a 30 day challenge. I started knowing little about functional programming, apart from the various array methods within JavaScript. Kyle Simpson’s Functional Light JavaScript book, has been a great introduction of concepts and practical application. For those interested, the book can also be read for free on GitHub. In this post, I share some of the practical concepts of functional programming I have learned since starting this challenge, as well as refactor a code example using functional composition. There’s lots of code examples and functional goodies along the way. Note: The code snippets include several functional programming helper functions. An example implementation of these utilities is included in the snippets, but can also be found in libraries such as Ramda. ...

August 12, 2019 · 8 min · Skyler Lemay

30 Days of Functional Programming

“And though each habit means relatively little on its own, over time, the meals we order, what we say to our kids each night, whether we save or spend, how often we exercise, and the way we organize our thoughts and work routines have enormous impacts on our health, productivity, financial security, and happiness.” ~Charles Duhigg I have long had a fascination with learning new things. However, it is generally unstructured and follows whatever the interest of the moment is. I have been and continue to be a proponent of motivation based learning, believing that we learn best when there is an internal vested interest. At least for me, one downside of this approach is a propensity for cursory knowledge on many topics without revisiting them in more depth. This large surface area of topics has resulted in consistently saying, “One day I will get back to exploring topic X in depth”. Anecdotal experience has indicates lower follow through. ...

August 1, 2019 · 2 min · Skyler Lemay