Functional Programming Languages
“Grokking Simplicity is by far the gentlest introduction to FP I've encountered and I've been recommending it to people that want an on-ramp to FP ever since.”
Functional programming is a fast-growing paradigm. In this guide, we will see the most famous functional programming languages. Along the way, we'll learn what functional programming is, the features that are common in functional languages, and explore languages that are not functional but that have some functional features.
People learn functional programming for many reasons. Some want to expand their understanding of programming, while others want to find a new job. Yet others find that functional programming is more natural to the way they think. Whatever reason is right for you, I have categorized the languages to help you find one that's right for you.
Table of Contents
- Functional languages summary
- What is functional programming?
- What is a functional programming language?
- What are some features of functional programming languages?
- Non-functional languages with functional features
- Functional languages with details
- Functional languages for different purposes
Functional languages in alphabetical order
Click any language for more details.
Clojure
A functional Lisp on the JVM
Elixir
Dynamic language for fault-tolerant systems
Elm
Frontend language with no runtime errors
Erlang
Fault-tolerant, functional, actor-based
F#
Functional language on the .NET platform
Haskell
Flagship functional language with expressive types
Idris
A functional languge for type-driven development
Kotlin
Expressive language for the JVM
OCaml
Functional, expressive, type-safe
PureScript
Typed functional programming that compiles to JavaScript
Racket
Modern Lisp
ReasonML
A new syntax and toolchain for OCaml
Rust
Language with memory safety and powerful compiler
Scala
Functional/object-oriented hybrid on the JVM (and JavaScript)
Scheme
Classic minimalist Lisp designed for teaching and exploration
Swift
Focused on safety, speed, and expressiveness
What is functional programming?
Functional programming is hard to define. You will find conflicting definitions everywhere. I like to define functional programming like this:
Functional programming is a way of programming where you distinguish between:
- actions—code that affects or is affected by the outside world, such as a function that sends an email or a function that reads from a microphone
- calculations—computations from inputs to outputs, such as a function that calculates the tax on an sale amount
- data—facts about events, such as the price of a product
Making this distinction separates the easy code (calculations and data) from the hard code (actions) so you can spend more attention on the hard stuff.
For a more comprehensive tutorial about functional programming, I recommend my book on the topic, Grokking Simplicity.
What is a functional programming language?
There is no absolute way to determine if a language is a functional programming language. However, by convention, functional programming languages encourage and support functional programming as the major mindset to use in the language. They do this through what they make easy, hard, and impossible.
What are some features of functional programming languages?
It is hard to define what features make a language functional. However, some features are more common in functional languages than in non-functional languages:
- Distinction between actions, calculations, and data
- Immutable data
- First-class functions
- Higher-order functions
- Mathematical type systems
- Lazy evaluation
- Emphasis on recursion over iteration
Many languages provide these features today. However, having these features does not make them functional. The predominant mindset is still procedural or object-oriented. For instance, JavaScript has first-class functions, but I do not consider it a functional language.
Non-functional languages with functional features
Is Java a functional programming language?
Classic object-oriented language
- Functional features
- Lambdas (first-class closures)
- Streams
- Functional interfaces
- Why it's not a functional langugage
- Mutable by convention
- Predominantly object-oriented
- Mixes actions and calculations
- Bottom Line
- Java is predominantly object-oriented. Recently, some functional features have been added. Their utility is questionable.
Is JavaScript a functional programming language?
The language of the browser
- Functional features
- First-class functions
- Pervasive use of higher-order functions
- Functional tools (map/filter/reduce)
- Data-orientation
- Why it's not a functional langugage
- Mutable by convention
- Pervasive use of side-effects
- Bottom Line
- JavaScript does support functional programming, but it requires a lot of discipline. It might be okay for writing functional code, but it's not great for learning functional programming.
Is Python a functional programming language?
Popular language
- Functional features
- First-class functions
- List comprehensions
- Functional tools (map/filter/reduce)
- Why it's not a functional langugage
- Mutable by convention
- Predominantly procedural
- Lambdas limited to one line
- Bottom Line
- Python is a popular and practical language. Though it does have some functional features, it is hard to do functional programming in it.
Functional languages with details
Clojure
A functional Lisp on the JVM
- Homepage
- Creator
- Company behind it
- Install guide
- Tutorial
- Try it online
- Platforms
- Description from their website
- Clojure is a robust, practical, and fast programming language with a set of useful features that together form a simple, coherent, and powerful tool.
Elixir
Dynamic language for fault-tolerant systems
- Homepage
- Creator
- Install guide
- Tutorial
- Try it online
- Platform
- Description from their website
- Elixir is a dynamic, functional language designed for building scalable and maintainable applications. Elixir leverages the Erlang VM, known for running low-latency, distributed and fault-tolerant systems, while also being successfully used in web development and the embedded software domain.
Elm
Frontend language with no runtime errors
- Homepage
- Creator
- Install guide
- Tutorial
- Try it online
- Platform
- Description from their website
- A delightful language for reliable webapps. Generate JavaScript with great performance and no runtime exceptions.
Erlang
Fault-tolerant, functional, actor-based
- Homepage
- Creators
- Company behind it
- Install guide
- Tutorial
- Try it online
- Platform
- Description from their website
- Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang's runtime system has built-in support for concurrency, distribution, and fault tolerance.
F#
Functional language on the .NET platform
- Homepage
- Creator
- Companies behind it
- Install guide
- Tutorial
- Try it online
- Platform
- Description from their website
- F# is a mature, open source, cross-platform, functional-first programming language. It empowers users and organizations to tackle complex computing problems with simple, maintainable and robust code.
Haskell
Flagship functional language with expressive types
- Homepage
- Creators
- Install guide
- Tutorial
- Try it online
- Description from their website
- Every expression in Haskell has a type which is determined at compile time. All the types composed together by function application have to match up. If they don't, the program will be rejected by the compiler. Types become not only a form of guarantee, but a language for expressing the construction of programs.
Idris
A functional languge for type-driven development
- Homepage
- Creator
- Install Guide
- Tutorial
- Try it online
- Description from their website
- Idris is a programming language designed to encourage Type-Driven Development.
Kotlin
Expressive language for the JVM
- Homepage url
- Company behind it
- Install guide and tutorial
- Try online
- Platforms
- Description from their website
- Kotlin is a modern, cross-platform, multi-purpose programming language. JetBrains started the design and development of the language back in 2010 and has watched it rapidly grow in popularity. Known for its concise syntax and pragmatic design, Kotlin provides ample opportunity for sharing and reusing code between multiple projects and platforms.
OCaml
Functional, expressive, type-safe
- Homepage
- Creators
- Install Guide
- Tutorial
- Try it online
- Description from their website
- OCaml is a general-purpose, industrial-strength programming language with an emphasis on expressiveness and safety.
PureScript
Typed functional programming that compiles to JavaScript
- Homepage
- Creator
- Install guide and tutorial
- Try it online
- Platform
- Description from their website
- A strongly-typed functional programming language that compiles to JavaScript.
Racket
Modern Lisp
- Homepage url
- Creator
- Company behind it
- Install guide
- Tutorial
- Platform
- Description from their website
- Racket is a general-purpose programming language as well as the world's first ecosystem for language-oriented programming. Make your dream language, or use one of the dozens already available.
ReasonML
A new syntax and toolchain for OCaml
- Homepage url
- Creator
- Company behind it
- Install guide
- Tutorial
- Try it online
- Platform
- Description from their website
- Reason is not a new language; it's a new syntax and toolchain powered by the battle-tested language, OCaml. Reason gives OCaml a familiar syntax geared toward JavaScript programmers, and caters to the existing NPM/Yarn workflow folks already know.
Rust
Language with memory safety and powerful compiler
- Homepage url
- Creator
- Company behind it
- Install guide
- Tutorial
- Try it online
- Platform
- Description from their website
- Rust is blazingly fast and memory-efficient: with no runtime or garbage collector, it can power performance-critical services, run on embedded devices, and easily integrate with other languages.
Scala
Functional/object-oriented hybrid on the JVM (and JavaScript)
- Homepage
- Creator
- Companies behind it
- Install guide
- Tutorial
- Try it online
- Platform
- Description from their website
- Scala combines object-oriented and functional programming in one concise, high-level language. Scala's static types help avoid bugs in complex applications, and its JVM and JavaScript runtimes let you build high-performance systems with easy access to huge ecosystems of libraries.
Scheme
Classic minimalist Lisp designed for teaching and exploration
- Homepage
- Creators
- Tutorial
- Try it online
Swift
Focused on safety, speed, and expressiveness
- Homepage
- Creator
- Company behind it
- Tutorial
- Try it online
- Description from their website
- Announced in 2014, the Swift programming language has quickly become one of the fastest growing languages in history. Swift makes it easy to write software that is incredibly fast and safe by design. Our goals for Swift are ambitious: we want to make programming simple things easy, and difficult things possible.
Functional languages for different purposes
Functional languages with the most jobs
You may be thinking of learning a new language to get a job doing functional programming. Functional programming jobs are considered rare in the industry, but they do exist. To maximize your chances of learning a language you can get a job in, you should pick one of these languages.
Job count data comes from indeed.com.
Tier 1
Although all of the languages listed previously are production-ready, these four languages have a lot of jobs listed. Ordered roughly from easiest to hardest to get started with.
Tier 2
These three languages don't have as many jobs as the previous list, but there are still many opportunities out there. Ordered roughly from easiest to hardest to get started with.
Functional languages by platform
Another way to organize functional languages is by what's available on the platform you are targeting.
Browser (JavaScript engine)
Ordered roughly from easiest to hardest to get started with.
Web backend
Ordered roughly from easiest to hardest to get started with.
Mobile (iOS and Android)
- Native iOS
- Dalvik (JVM) Android
- Native Android
- Xamarin iOS and Android
- React Native iOS and Android
- ClojureScript (see this)
- Scala.js
- F# (see this)
Embedded devices
- Kotlin (see Kotlin/Native)
- Rust
Functional languages by learning opportunity
Immersing yourself in a language can help you learn. You can choose a language based on what it can teach you. Here, you'll find the languages organized by prominent features. They can create a wonderful, immersive learning environment.
Static typing
The most advanced type systems found today are in functional languages. These type systems are based on mathematical logic and are proven to be consistent. Types do more than prevent errors. They can also guide you to design better software. Having a good type system is like having a logician on your shoulder, coaching you into good software. If you'd like to learn more, these languages will immerse you:
Functional tools and data transformation
Most functional languages have good functional tools for doing data transformation. But these languages excel at it. Instead of encouraging you to define new types, these languages operate on a small number of data types and a large number of operations on them.
Concurrency and distributed systems
Most functional languages are good at dealing with multiple threads, mostly because of immutable data structures. However, some excel at it by focusing primarily on that task. These languages have great facilities for correctly managing multiple timelines in a straightforward way. They are organized by different classes of facilities.