small medium large xlarge

Learn Functional Programming with Elixir: New Foundations for a New World


Cover image for Learn Functional Programming with Elixir

Learn Functional Programming with Elixir

New Foundations for a New World


Elixir’s straightforward syntax and this guided tour give you a clean, simple path to learn modern functional programming techniques. No previous functional programming experience required! This book walks you through the right concepts at the right pace, as you explore immutable values and explicit data transformation, functions, modules, recursive functions, pattern matching, high-order functions, polymorphism, and failure handling, all while avoiding side effects. Don’t board the Elixir train with an imperative mindset! To get the most out of functional languages, you need to think functionally. This book will get you there.

Customer Reviews

Learning to program in a functional style requires one to think differently. When
learning a new way of thinking, you cannot rush it. I invite you to read the book
slowly and digest the material thoroughly. The essence of functional programming
is clearly laid out in this book and Elixir is a good language to use for exploring
this style of programming.

- Kim Shrier

Independent Software Developer, Shrier and Deihl

Some years ago it became apparent to me that functional and concurrent programming
is the standard that discriminates talented programmers from everyone else.
Elixir’s a modern functional language with the characteristic aptitude for crafting
concurrent code. This is a great resource on Elixir with substantial exercises and
encourages the adoption of the functional mindset.

- Nigel Lowry

Company Director and Principal Consultant, Lemmata

This is a great book for developers looking to join the world of functional programming.
The author has done a great job at teaching both the functional paradigm
and the Elixir programming language in a fun and engaging way.

- Carlos Souza

Software Developer, Pluralsight

This book covers the functional approach in Elixir very well. It is great for beginners
and gives a good foundation to get started with advanced topics like OTP, Phoenix,
and metaprogramming.

- Gábor László Hajba

Senior Consultant, EBCONT enterprise technologies

Hands down the best book to learn the basics of Elixir. It’s compact, easy to read,
and easy to understand. The author provides excellent code examples and a great

- Stefan Wintermeyer

Founder, Wintermeyer Consulting

See All Reviews

Choose Your Format(s)

  • $21.95 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

What You Need

You’ll need a computer and Elixir 1.4 or newer version installed. No previous functional programming or Elixir experience is required. Some experience with any programming language is recommended.

Contents & Extracts

  • Introduction
    • Is This Book for You?
    • What’s in This Book?
    • Using Elixir
    • Online Resources
  • Thinking Functionally
    • Why Functional?
    • Working with Immutable Data
    • Building Programs with Functions
    • Declaring Code
    • Wrapping Up
  • Working with Variables and Functions
    • Representing Values
    • Executing Code and Generating a Result
    • Binding Values in Variables
    • Creating Anonymous Functions excerpt
    • Naming Functions
    • Wrapping Up
  • Using Pattern Matching to Control the Program Flow
    • Making Two Things Match
    • Unpacking Values from Various Data Types
    • Control Flow with Functions
    • Expanding Control with Guard Clauses
    • Elixir Control-Flow Structures
    • Wrapping Up
  • Diving into Recursion
    • Surrounded by Boundaries
    • Conquering Recursion excerpt
    • Tail-Call Optimization
    • Functions Without Borders
    • Using Recursion with Anonymous Functions
    • Wrapping Up
  • Using Higher-Order Functions
    • Creating Higher-Order Functions for Lists excerpt
    • Using the Enum Module
    • Using Comprehensions
    • Pipelining Your Functions
    • Be Lazy
    • Wrapping Up
  • Designing Your Elixir Applications
    • Starting Your Project with Mix
    • Designing Entities with Structs
    • Using Protocols to Create Polymorphic Functions
    • Creating Module Behaviours
    • Wrapping Up
  • Handling Impure Functions
    • Pure vs. Impure Functions
    • Controlling the Flow of Impure Functions
    • Trying, Rescuing, and Catching
    • Handling Impure Functions with the Error Monad
    • Using with
    • Wrapping Up
  • Adding Rooms to the Game
  • Answers to Exercises
    • Answers for Chapter 2, Working with Variables and Functions
    • Answers for Chapter 3, Using Pattern Matching to Control the Program Flow
    • Answers for Chapter 4, Diving into Recursion
    • Answers for Chapter 5, Using Higher-Order Functions


Ulisses Almeida is a software consultant at Plataformatec, the company that created Elixir. He works on crafting applications, coaching beginner developers, and advising customers on best practices to build robust and maintainable systems.