You are previewing Études for Erlang.
O'Reilly logo
Études for Erlang

Book Description

In this book, you will find descriptions of programs that you can write in Erlang. The programs will usually be short, and each one has been designed to provide practice material for a particular Erlang programming concept. These programs have not been designed to be of considerable difficulty, though they may ask you to stretch a bit beyond the immediate material and examples that you find in the book Introducing Erlang.

Table of Contents

  1. Études for Erlang
  2. Études for Erlang
    1. Contributor Guidelines
    2. How to Contribute
      1. Create a GitHub account
      2. Copy (“fork”) the project repository to your account
      3. Edit your file using AsciiDoc
      4. Double check your submission and add your biography
      5. Submit a pull request
      6. Engage in back-and-forth
  3. Preface: What’s an étude?
    1. What are Études for Erlang?
    2. How This Book was Written
    3. Working with Other Books
    4. Acknowledgments
  4. 1. Getting Comfortable with Erlang
    1. Étude 1-1: Experimenting with Errors
  5. 2. Functions and Modules
    1. Étude 2-1: Writing a Function
    2. Étude 2-2: Documenting a Module
    3. Étude 2-3: Documenting a Function
  6. 3. Atoms, Tuples, and Pattern Matching
    1. Étude 3-1: Pattern Matching
    2. Étude 3-2: Guards
    3. Étude 3-3: Underscores
    4. Étude 3-4: Tuples as Parameters
  7. 4. Logic and Recursion
    1. Étude 4-1: Using case
    2. Étude 4-2: Recursion
    3. Étude 4-3: Non-Tail Recursive Functions
    4. Étude 4-4: Tail Recursion with an Accumulator
    5. Étude 4-5: Recursion with a Helper Function
  8. 5. Strings
    1. Étude 5-1: Validating Input
    2. Étude 5-2: Using the re Module
  9. 6. Lists
    1. Étude 6-1: Recursive Iteration through a List
    2. Étude 6-2: Iteration through Lists (More Practice)
    3. Étude 6-3: Accumulating the Sum of a List
    4. Interlude: “Mistakes were made.”
    5. Étude 6-4: Lists of Lists
    6. Étude 6-5: Random Numbers; Generating Lists of Lists
  10. 7. Higher Order Functions and List Comprehensions
    1. Étude 7-1: Simple Higher Order Functions
    2. Étude 7-2: List Comprehensions and Pattern Matching
      1. Part One
      2. Part Two
    3. Étude 7-3: Using lists:foldl/3
    4. Étude 7-4: Using lists:split/2
    5. Étude 7-5: Multiple Generators in List Comprehensions
    6. Étude 7-6: Explaining an Algorithm
  11. 8. Processes
    1. Étude 8-1: Using Processes to Simulate a Card Game
      1. The Art of War
      2. War: What is it good for?
      3. Pay Now or Pay Later
      4. The Design
      5. Messages Are Asynchronous
      6. Hints for Testing
  12. 9. Handling Errors
    1. Étude 9-1: try and catch
    2. Étude 9-2: Logging Errors
  13. 10. Storing Structured Data
    1. Étude 10-1: Using ETS
      1. Part One
      2. Part Two
      3. Part Three
    2. Étude 10-2: Using Mnesia
      1. Part One
      2. Part Two
      3. Part Three
  14. 11. Getting Started with OTP
    1. Étude 11-1: Get the Weather
      1. Obtaining Weather Data
      2. Parsing the Data
      3. Set up a Supervisor
    2. Étude 11-2: Wrapper Functions
    3. Étude 11-3: Independent Server and Client
    4. Étude 11-4: Chat Room
      1. The chatroom Module
      2. The person Module
      3. Wrapper Functions for the person module
      4. Putting it All Together
  15. A. Solutions to Études
    1. Solution 2-1
      1. geom.erl
    2. Solution 2-2
      1. geom.erl
    3. Solution 2-3
      1. geom.erl
    4. Solution 3-1
      1. geom.erl
    5. Solution 3-2
      1. geom.erl
    6. Solution 3-3
      1. geom.erl
    7. Solution 3-4
      1. geom.erl
    8. Solution 4-1
      1. geom.erl
    9. Solution 4-2
      1. dijkstra.erl
    10. Solution 4-3
      1. powers.erl
      2. powers_traced.erl
    11. Solution 4-4
      1. powers.erl
      2. powers_traced.erl
    12. Solution 4-5
      1. powers.erl
    13. Solution 5-1
      1. geom.erl
      2. ask_area.erl
    14. Solution 5-2
      1. dates.erl
    15. Solution 6-1
      1. stats.erl
    16. Solution 6-2
      1. stats.erl
    17. Solution 6-3
      1. dates.erl
    18. Solution 6-4
      1. teeth.erl
      2. stats.erl
    19. Solution 6-5
      1. non_fp.erl
    20. Solution 7-1
      1. calculus.erl
    21. Solution 7-2
      1. patmatch.erl
    22. Solution 7-3
      1. stats.erl
    23. Solution 7-4
      1. dates.erl
    24. Solution 7-5
      1. cards.erl
    25. Solution 7-6
      1. cards.erl
    26. Solution 8-1
      1. cards.erl
      2. game.erl
    27. Solution 9-1
      1. stats.erl
    28. Solution 9-2
      1. bank.erl
    29. Solution 10-1
      1. phone_records.hrl
      2. phone_ets.erl
      3. generate_calls.erl
    30. Solution 10-2
      1. phone_records.hrl
      2. phone_mnesia.erl
      3. pet_records.hrl
      4. pet_mnesia.erl
    31. Solution 11-1
      1. weather.erl
      2. weather_sup.erl
    32. Solution 11-2
      1. weather.erl
    33. Solution 11-3
    34. Solution 11-4
      1. chatroom.erl
      2. person.erl
  16. Copyright