Table of Contents
Introduction
- About this tutorial
- So what's Erlang?
- Don't drink too much Kool-Aid
- What you need to dive in
- Where to get help
Starting Out
Starting Out (for real)
- Numbers
- Invariable Variables
- Atoms
- Boolean Algebra and Comparison Operators
- Tuples
- Lists
- List Comprehensions
- Bit Syntax
- Binary Comprehensions
Modules
Syntax in Functions
Types (or lack thereof)
Recursion
- Hello recursion!
- Length
- Length of Tail Recursion
- More recursive functions
- Quick, Sort!
- More than lists
- Thinking recursively
Higher Order Functions
Errors and Exceptions
- Not so fast!
- A Compilation of Errors
- No, YOUR logic is wrong!
- Run-time Errors
- Raising Exceptions
- Dealing with Exceptions
- Wait, there's more!
- Try a try in a tree
Functionally Solving Problems
A Short Visit to Common Data Structures
- Won't be too long, promised!
- Records
- Key-Value Stores
- Arrays
- A Set of Sets
- Directed Graphs
- Queues
- End of the short visit
The Hitchhiker's Guide to Concurrency
- Don't Panic
- Concepts of Concurrency
- Not Entirely Unlike Linear Scaling
- So long and thanks for all the fish!
More On Multiprocessing
Errors and Processes
Designing a Concurrent Application
- Understanding the Problem
- Defining the Protocol
- Lay Them Foundations
- An Event Module
- The Event Server
- Hot Code Loving
- I Said, Hide Your Messages
- A Test Drive
- Adding Supervision
- Namespaces (or lack thereof)
What is OTP?
- It's The Open Telecom Platform!
- The Common Process, Abstracted
- The Basic Server
- Specific Vs. Generic
Clients and Servers
Rage Against The Finite-State Machines
- What Are They?
- Generic Finite-State Machines
- A Trading System Specification
- Game trading between two players
- That Was Quite Something
- Fit for the Real World?
Event Handlers
Who Supervises The Supervisors?
- From Bad to Good
- Supervisor Concepts
- Using Supervisors
- Child Specifications
- Testing it Out
- Dynamic Supervision
Building an Application With OTP
- A Pool of Processes
- The Onion Layer Theory
- A Pool's Tree
- Implementing the Supervisors
- Working on the Workers
- Writing a Worker
- Run Pool Run
- Cleaning the Pool
Building OTP Applications
- Why Would I Want That?
- My Other Car is a Pool
- The Application Resource File
- The Application Behaviour
- From Chaos to Application
- Library Applications
The Count of Applications
Release is the Word
- Am I an Executable Yet?
- Fixing The Leaky Pipes
- Releases With Systools
- Releases With Reltool
- Recipes
- Released From Releases
Leveling Up in The Process Quest
- The Hiccups of Appups and Relups
- The 9th Circle of Erl
- Progress Quest
- Making Process Quest Better
- Appup Files
- Upgrading the Release
Buckets Of Sockets
- IO Lists
- TCP and UDP: Bro-tocols
- UDP Sockets
- TCP Sockets
- More Control With Inet
- Sockserv, Revisited
- Where to go From Now?
EUnited Nations Council
- The Need for Tests
- EUnit, What's a EUnit?
- Test Generators
- Fixtures
- Testing Regis
- He Who Knits Eunits
Bears, ETS, Beets
- The Concepts of ETS
- ETS Phone Home
- Meeting Your Match
- You Have Been Selected
- DETS
- A Little Less Conversation, A Little More Action Please
Distribunomicon
- Alone in the Dark
- This is my Boomstick
- Fallacies of Distributed Computing
- Dead or Dead Alive
- My Other CAP is a Theorem
- Setting up an Erlang Cluster
- Cookies
- Remote Shells
- Hidden Nodes
- The Walls are Made of Fire and the Goggles do Nothing
- The Calls from Beyond
- Burying the Distribunomicon
Distributed OTP Applications
Common Test for Uncommon Tests
- What is Common Test
- Common Test Cases
- Testing With State
- Test Groups
- The Meeting Room
- Test Suites
- Test Specifications
- Large Scale Testing
- Integrating EUnit within Common Test
- Is There More?
Mnesia And The Art of Remembering
- What's Mnesia
- What Should the Store Store
- From Record to Table
- Of Schemas and Mnesia
- Creating Tables for Real
- Access and Context
- Reads, Writes, and More
- Implementing The First Requests
- Accounts And New Needs
- Meet The Boss
- Deleting Stuff, Demonstrated
- Query List Comprehensions
- Remember Mnesia
Type Specifications and Erlang
- PLT Are The Best Sandwiches
- Success Typing
- Type Inference and Discrepancies
- Typing About Types of Types
- Typing Functions
- Typing Practice
- Exporting Types
- Typed Behaviours
- Polymorphic Types
- You're my Type
Conclusion
Postscript: Maps
- About This Chapter
- EEP, EEP!
- What Maps Shall Be
- Stubby Legs for Early Releases
- Mexican Standoff
- How This Book Would Be Revised For Maps