This book is the introduction to Elixir for experienced programmers, completely updated for Elixir 1.6 and beyond. Explore functional programming without the academic overtones (tell me about monads just one more time). Create concurrent applications, butget them right without all the locking and consistency headaches. Meet Elixir, a modern, 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 interestedfor the long haul. Maybe the time is right for the Next Big Thing. Maybe it's Elixir.
Functional programming techniques help you manage the complexities of today's real-world, concurrent systems; maximize uptime; and manage security. Enter Elixir, with its modern, Ruby-like, extendable syntax, compile and runtime evaluation, 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. Part 3 looks at the more advanced features of the language, from DSLs and code generation to extending the syntax.
This edition is fully updated with all the new features of Elixir 1.6, with a new chapter on structuring OTP applications, and new sections on the debugger, code formatter, Distillery, and protocols.
What You Need:
You'll need a computer, a little experience with another high-levellanguage, and a sense of adventure. No functional programmingexperience is needed.
Table of Contents
Chapter 1. Take The Red Pill
Part I. Conventional Programming
Chapter 2. Pattern Matching
Chapter 3. Immutability
Chapter 4. Elixir Basics
Chapter 5. Anonymous Functions
Chapter 6. Modules And Named Functions
Chapter 7. Lists And Recursion
Chapter 8. Maps, Keyword Lists, Sets, And Structs
Chapter 9. An Aside—What Are Types?
Chapter 10. Processing Collections—Enum And Stream
Chapter 11. Strings And Binaries
Chapter 12. Control Flow
Chapter 13. Organizing A Project
Chapter 14. Tooling
Part II. Concurrent Programming
Chapter 15. Working With Multiple Processes
Chapter 16. Nodes—The Key To Distributing Services
Chapter 17. Otp: Servers
Chapter 18. Otp: Supervisors
Chapter 19. A More Complex Example
Chapter 20. Otp: Applications
Chapter 21. Tasks And Agents
Part III. More Advanced Elixir
Chapter 22. Macros And Code Evaluation
Chapter 23. Linking Modules: Behavio(U)Rs And Use
Chapter 24. Protocols—Polymorphic Functions
Chapter 25. More Cool Stuff
Appendix A1. Exceptions: Raise And Try, Catch And Throw
Appendix A2. Type Specifications And Type Checking