Using the function map to change the elements of a list has become a common pattern in modern programming languages. It is often used in Elm and map is also used in Elm for the Maybe and Result types.
A more hands on approach to functional programming.
When I first started learning functional programming, I had already been programming for many years, mostly in object oriented languages the last decade. How would the architecture for a functional program look like? How can we avoid mutation, which is a cornerstone of OOP? How can functions be used as an abstraction?
This article will introduce an important and interesting concept in functional programming: Monoids. The focus will be on monoids in Haskell.
There are plenty of buzzwords when it comes to type systems. Today we take a closer look at the concepts related to kinds.
F# is a fun and mature functional-first programming language for the .NET platform. Taking the first steps to learn a new language can be daunting, so in this post, we'll give some pointers on where to start.
In this article, we compare error handling methods in Kotlin; specifically: exceptions, Either, and Result.
When making web applications most times you fetch stuff from some remote location, and usually with XHR. These operations are asynchronous and can fail for a myriad of reasons. Handling them well is important to make sure the users of your applications have a good time.
Today we are excited to reveal the second article from our guest writer Dillon Kearns, known for projects such as elm-graphql, elm-typescript-interop, and the Elm Radio podcast! If you didn't catch the one from yesterday, be sure to check it out as well! We hope you enjoy!
Today and tomorrow we are excited to have a guest writer sharing some of his thoughts on the topic of functional programming: Dillon Kearns, known for projects such as elm-graphql, elm-typescript-interop, and the Elm Radio podcast! We hope you enjoy!
Last year I wrote an article explaining functors in simple terms and show why they are useful. It has well received, but some felt it was lacking in details which is true and by design. There is more to be said and some crucial details that I glossed over so I will try to address some of them now. Let’s get nerdy!
In my experience Functional Programming (FP) can be something that is hard to get your head around. This is particularly true if you're very set in your ways from working in another paradigm. In this short read I hope to explain my journey up the FP mountain, as well as detailing some of my obstacles along the way. While the main goal of the writing is to re-inspire people with disappointing prior experiences, I also hope it will create a spark of curiosity for first timers.
Today I want to give you an introduction to the programming language Elixir, some of its features and why you might want to check it out!
This is an opinionated post. Consider yourself warned. You will probably disagree with at least some of it, and that is completely fine. The important part is the thought process – don’t just read through it and agree or disagree, think about what you agree or disagree with and why. Becoming aware of these things is valuable: once you become aware of why you dislike something, you can start doing something about it.
Welcome to another year of the functional programming advent calendar! Every day until December 24th you will get an article, video or other functional programming related content that hopefully will make the waiting feel a bit shorter! 😄
A functor might sound very strange and esoteric but chances are you have used it in some ways. Some of you probably a lot! In this article we will look at what they are and some reasons they are useful.
In this article we will take a small peak into the general concept of combining things with other things. We all know about and how to use the plus operator from everyday math and programming. So why do I want to write it? There is in fact a generalization of the concept that is pretty neat that I hope you also will find useful. It can be a door opener for understanding the behaviour you get from algebraic laws. First things first, what are we actually talking about? Let us take a look at a few different operations on text and numbers.
A short tale about my struggle to comprehend why C# isn't a functional language.
In this post, I'll show that C# implements the functional concepts map and bind. I'll further show that these are useful for other contexts than just collections with an example implementation for Task<T>. We'll then clean up a process by using map and bind to compose a new process of several smaller processes. Hopefully this will show that functional concepts both exists and are useful even in non-functional languages.
In this article I would like to introduce you to two common composition operators and explain some of their utility, using first a made up example, and then an example from the real world. These operators are all about composing functions of slightly weird types. For while regular function composition combines functions of types a -> b and b -> c, these guys concern themselves with combining functions of types which don't naturally fit perfectly together.
This post explores how you can create your own generative art in the web browser using functional programming in the ClojureScript programming language.
Tail recursion is a special way of writing recursive functions such that a compiler can optimize the recursion away and implement the algorithm as a loop instead. This is not because loops are inherently faster, but because every function call generally incurs the cost of a new stack frame in which it executes, sometimes leading to the dreaded stack overflow - where the beloved site of the same name, gets its name. Let's investigate how this works.
Iteration is part of the bread and butter of any programming language, and this is the case in functional programming just as much as in imperative programming, but how is it possible to iterate without for, foreach or while?
In this article I will give a brief overview of what a monad is. Later articles in this series will use monadic features in different programming examples, therefore I thought it would be a good idea to first give an overview of what a monad is. I will use metaphors to explain the concept, and I will not give any code examples in this article.
You should always strive to make, and make use of, immutable data structures. Even if your domain is inherently mutable (like most domains, really), there are quite a few pitfalls that can give you headaches later on if you also use mutable data structures. Many of them are avoidable simply by making it harder to accidentally modify data.
Architecture in Functional Programming (FP) and Object Oriented Programming (OOP) is very different. While the class is the main abstraction in OOP, the function is the abstraction in FP. Looking over the fence, it seems impossible to solve problems using the other paradigm. In order to learn how to design program with functions, we must first learn how they work in FP as a function is not the same as a method.