Watch_me

You want to explore functional programming, but are put off by the academic feel (tell me about monads just one more time). You know you need concurrent applications, but also know these are almost impossible to get right. Meet Elixir, a functional, concurrent language built on the rock-solid Erlang VM. Elixir’s pragmatic syntax and built-in support for metaprogramming will make you productive and keep you interested for the long haul. This book is the introduction to Elixir for experienced programmers.

Maybe you need something that’s closer to Ruby, but with a battle-proven environment that’s unrivaled for massive scalability, concurrency, distribution, and fault tolerance. Maybe the time is right for the Next Big Thing. Maybe it’s Elixir.

Check out the short video on Elixir at youtu.be/hht9s6nAAx8, or the 30 minute, more detailed video at youtu.be/a-off4Vznjs and enjoy.

And don’t forget to download this handy cheat sheet for Elixir syntax.

Print books will be available after Elixir 1.0 has been finalized.

Buy Now

Select a DRM-free Format:

In Stock
In Stock
Buy the eBook and get these DRM-free formats delivered immediately:
  • epub (for iPhone/iPad, Android, eReaders)
  • mobi (for Kindle)
  • PDF
We can automatically send them to your Kindle or Dropbox, and for a social reading experience we can link the book to your Readmill account. (You'll need to log in to enable these options.)

This title is currently available in Beta. Buy the eBook now, and you'll be able to download successive releases of the eBook as the authors add material and correct mistakes. You'll get the final eBook when the book is finished.

If you buy the combo pack (Beta eBook + finished Paper Book) now, you'll get the Beta eBook immediately. You'll get the finished paper book when it's released (we're currently estimating 2014-09-30, but these dates can change).

 

About this Book

  • 240 pages (est)
  • Published:
  • Release: B12.0.12.3 (2014-02-07)
  • ISBN: 978-1-93778-558-1

As a developer, you’ve probably heard that functional programming techniques help manage the complexities of today’s real-world, concurrent systems. You’re also investigating designs that help you maximize uptime and manage security.

This book is your guide to Elixir, a modern, functional, and concurrent programming language. Because Elixir runs on the Erlang VM, and uses the underlying Erlang/OTP architecture, it benefits from almost 20 years of research into high performance, highly parallel, and seriously robust applications. Elixir brings a lot that’s new: a modern, Ruby-like, extendable syntax, compile and runtime evaluation, a hygienic macro system, and more.

But, just as importantly, Elixir brings a sense of enjoyment to parallel, functional programming. Your applications become fun to work with, and the language encourages you to experiment.

Part 1 covers the basics of writing sequential Elixir programs. We’ll look at the language, the tools, and the conventions.

Part 2 uses these skills to start writing concurrent code—applications that use all the cores on your machine, or all the machines on your network! And we do it both with and without OTP.

And Part 3 looks at the more advanced features of the language, from DSLs and code generation to extending the syntax.

By the end of this book, you’ll understand Elixir, and know how to apply it to solve your complex, modern problems.

Print books will be available after Elixir 1.0 has been finalized.

What You Need

You’ll need a computer, a little experience with another high-level language, and a sense of adventure. No functional programming experience is needed.

Contents and Extracts

This book is currently in beta, so the contents and extracts will change as the book is developed.

Check out the short video on Elixir at youtu.be/hht9s6nAAx8, or the 30 minute, more detailed video at youtu.be/a-off4Vznjs and enjoy.

And don’t forget to download this handy cheat sheet for Elixir syntax.

Preface/Introduction

  • Conventional Programming
    • Pattern Matching
      • Assignment: I do not think it means what you think it means
      • More Complex Matches
      • Ignoring a Value With _
      • Variables Bind Once (Per Match)
      • Another way of looking at the equals sign
    • Immutability
      • You Already Have (Some) Immutable Data
      • Immutable Data Is Known Data
      • Performance Implications of Immutability
      • Coding With Immutable Data
    • Elixir Basics
      • Value Types
      • System Types
      • Collection Types
      • Names, Source Files, Conventions, Operators, and So On
      • End of the Basics
    • Anonymous Functions
      • Functions and Pattern Matching
      • One Function, Multiple Bodies
      • Functions Can Return Functions
      • Passing Functions as Arguments
      • Functions Are The Core
    • Modules and Named Functions
      • The Body of the Function is a Block
      • Function Calls and Pattern Matching
      • Guard Clauses
      • Default Parameters
      • |> — The Amazing Pipe Operator
      • Modules
      • Module Attributes
      • Module Names: Elixir, Erlang, and Atoms
      • Finding Libraries
    • Lists and Recursion excerpt
      • Heads and Tails
      • Using Head and Tail to Process a List
      • Using Head and Tail to Build a List
      • Creation of a Map Function
      • Keeping Track of Values During Recursion
      • More Complex List Patterns
      • List Comprehensions
      • Using the Built-in Libraries
      • List Libraries in Action
    • Processing Collections—Enum and Stream
      • Enum—Processing Collections
      • Streams—Lazy Enumerables
    • Strings and Binaries
      • String Literals
      • The Name “strings”
      • Single Quoted Strings—Lists of Character Codes
      • Binaries
      • Double Quoted Strings are Binaries
      • Binaries and Pattern Matching
    • Records
      • Defining Records: defrecord
      • Records and Pattern Matching
      • Advanced Records
    • Control Flow
      • if and unless
      • cond
      • case
      • Raising Exceptions
      • Designing With Exceptions
      • What we’ve seen
    • Organizing a Project
      • The Project: Fetch Issues from Github
      • Task: Use Mix to Create our New Project
      • Transformation: Parse the Command Line
      • Step: Write Some Basic Tests
      • Transformation: Fetch from Github
      • Task: Use External Libraries
      • Transformation: Convert Response
      • Transformation: Take First N Items
      • Transformation: Format the Table
      • Task: Make a command line executable
      • Task: Test The Comments
      • Task: Create Project Documentation
      • What We’ve Just Seen
  • Concurrent Programming
    • Working With Multiple Processes
      • A Simple Process
      • Process Overhead
      • When Processes Die
      • Parallel Map—The Hello World of Erlang
      • A Fibonacci Server
      • What’s Next
    • Nodes—The Key To Distributing Services excerpt
      • Naming Nodes
      • Naming Your Processes
      • I/O, PIDs, and Nodes
      • What’s Next
    • OTP: Servers
      • Some OTP Definitions
      • An OTP Server
      • GenServer Callbacks
      • Naming A Process
      • Tidying Up The Interface
      • What We Learned
    • OTP: Supervisors
      • Supervisors And Workers
      • Supervisors Are The Heart of Reliability
    • OTP: Applications
      • Application: I do not think it means what you think it means
      • The Application Specification File
      • Turning Our Sequence Program into an OTP Application
      • Tell Mix About The Application
      • Create the application OTP entry point
      • Hot Code Swapping
      • OTP is Big. Unbelievably Big
  • More Advanced Elixir
    • Macros and Code Evaluation
    • Protocols—Polymorphic Functions
    • Linking Modules: Behavio(u)rs and Use
    • More Cool Stuff

About the Author

Dave Thomas is a programmer who likes to evangelize cool stuff. He cowrote The Pragmatic Programmer, and was one of the creators of the Agile Manifesto. His book Programming Ruby introduced the Ruby language to the world, and Agile Web Development with Rails helped kickstart the Rails revolution.

Upcoming Author Events