small medium large xlarge

Errata for Programming Elixir

 

The latest version of the book is P1.0, released over 1 year ago. If you've bought a PDF of the book and would like to upgrade it to this version (for free), visit your home page.

By default this page displays the errata for the latest version of the book. If you have a previous version, select it here:

If you've found a new error, please submit it.

  • Typo
  • Tech. error
  • Suggestion
  • Maybe next edition
  • Not a problem
  • Reported in: P1.0 (22-Oct-14)
#77682
PDF page: 2
Table of Contents looks terrible. Previous versions show the chapters and topics well indented. In this version, there is no indentation on .epu...more...
  • Reported in: P1.0 (27-Jun-15)
  • Fixed: 29-Dec-15, awaiting book release
#78545
PDF page: 21

"divvied" should have been "divided"--Srikanth Shreenvas

Dave Thomas says: "Divvied" is a word... :)
  • Reported in: P1.0 (26-Nov-15)
  • Fixed: 29-Dec-15, awaiting book release
#79229
PDF page: 24
"Atoms" section: A few pages down, while experimenting in iex with maps that have atoms as keys, I was getting an error about aliases. I had made stat...more...
  • Reported in: Pre1.0 (07-Oct-14)
  • Fixed: 29-Dec-15, awaiting book release
#77566
PDF page: 32

arithmetic operators

I believe that rem and dev ar no operators (any more?).
Or am I doing something stupid in my iex?--Robert Dober

Dave Thomas says: See the next paragraph. It is called as a function.
  • Reported in: P1.0 (02-May-15)
  • Fixed: 29-Dec-15, awaiting book release
#78393
PDF page: 58
in iex 1.0.4 both "Elixir.IO" === IO and "Elixir.IO".puts 123 now result in an error, so something has changed here in Elixirs internal processing.--...more...
Dave Thomas says: I hate to do this, but it works for me on 1.2.
  • Reported in: P1.0 (21-Sep-15)
#78839
PDF page: 58

The word "in" in "** (ArithmeticError) bad argument in arithmetic expression" should not be highlighted, as it is output and not elixir code.

  • Reported in: P1.0 (02-Dec-14)
  • Fixed: 29-Dec-15, awaiting book release
#77879
PDF page: 62
The example under "Using Head and Taill to Process a List" lists/mylist.exs reports this error when loaded into iex: can use only variables and \\ as ...more...
Dave Thomas says: I don't see that error here.
  • Reported in: P1.0 (17-Dec-14)
  • Fixed: 29-Dec-15, awaiting book release
#77941
PDF page: 64
The section on default parameters could use better examples. To follow on from the 'greeting' example that's in the book, you could have something ...more...
Dave Thomas says: Thanks for the suggestion, but I think I'll leave it for now. I'm trying to keep things terse.
  • Reported in: P1.0 (19-Sep-15)
  • Fixed: 29-Dec-15, awaiting book release
#78835
PDF page: 71
lists/weather.exs: def test_data do [ [1366225622, 26, 15, 0.125], [1366225622, 27, 15, 0.45], [1366225622, 28, 21, 0.25], [1366229...more...
Dave Thomas says: I don't see that issue here.
  • Reported in: P1.0 (17-Dec-14)
  • Fixed: 29-Dec-15, awaiting book release
#77940
PDF page: 72
The footnote that links to the Erlang docs for format/2 has a ">" at the end: ...erlang.org/doc/man/io.html#format-2> Hah, the form doesn't allow h...more...
  • Reported in: P1.0 (30-Oct-14)
  • Fixed: 29-Dec-15, awaiting book release
#77740
PDF page: 73
The book has this example: iex> l = List.zip([[1,2,3], [:a,:b,:c], ["cat", "dog"]]) [{1, :a, "cat"}, {2, :b, "dog"}] iex> List.unzip(l) [[1, 2],...more...
  • Reported in: P1.0 (12-Dec-14)
#77916
Paper page: 78

Broken reflink at end of second paragraph. Shows metadata for link rather than actual hyperlink. --Luke van derHoeven

Dave Thomas says: I can't find this.
  • Reported in: P1.0 (11-Oct-15)
  • Fixed: 29-Dec-15, awaiting book release
#78983
PDF page: 82
The example "maps/derive.exs" doesn't work. The example code: defmodule Attendee do @derive Access defstruct name: "", over_18: false end...more...
  • Reported in: P1.0 (14-Dec-14)
  • Fixed: 29-Dec-15, awaiting book release
#77925
Paper page: 83
In the first paragraph of the subsection "Nested Accessors and Nonstructs". I think Dave had his Ruby hat on here and where says "you can supply keys ...more...
  • Reported in: P1.0 (05-Jan-16)
#79534
PDF page: 89
"Some of them share an additional trait: you can add things to them." Technically, this isn't true. If data is indeed immutable in Elixir, you can ...more...
  • Reported in: P1.0 (05-Jan-16)
#79535
PDF page: 89
"Some of them share an additional trait: you can add things to them." Technically, this isn't true. If data is indeed immutable in Elixir, you can ...more...
  • Reported in: P1.0 (09-Dec-14)
  • Fixed: 29-Dec-15, awaiting book release
#77902
PDF page: 90
Before using `Integer.is_even/1` twice in the example, you must `require Integer` in iex, or you get "** (CompileError) iex:16: you must require Integ...more...
  • Reported in: P1.0 (20-Jan-15)
  • Fixed: 29-Dec-15, awaiting book release
#78063
Paper page: 98
The code for the Stream.open example using Stream.resource causes an error. It seems that instead of the line: fn file -> it needs to be: fn {:ok, ...more...
  • Reported in: P1.0 (08-Feb-15)
  • Fixed: 29-Dec-15, awaiting book release
#78167
PDF page: 104
LPRALL-M-7063:elixir lprall$ iex Erlang/OTP 17 [erts-6.3] [source-f9282c6] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] Intera...more...
Dave Thomas says: You're missing the three item term at the end: { :where, "Dallas", "TX"} This will change the output formatting you're seeing
  • Reported in: P1.0 (30-Oct-14)
  • Fixed: 29-Dec-15, awaiting book release
#77744
Paper page: 104

Under 'Your Turn': "... you wrote a span funtion". Should be 'function' (missing c).--Lars Storjord

  • Reported in: P1.0 (30-Oct-14)
  • Fixed: 29-Dec-15, awaiting book release
#77745
Paper page: 104

Under "Here is a list of orders", the last order id is 120. Should probably be 130, since the rest are in numerical order.--Lars Storjord

  • Reported in: P1.0 (02-Nov-14)
#77761
Paper page: 124
Output from iex shows 'true part' with true formatted as a keyword and part formatted as regular code. It should be formatted like a string, i.e. with...more...
  • Reported in: P1.0 (02-Nov-14)
  • Fixed: 29-Dec-15, awaiting book release
#77762
Paper page: 127
Nitpicking: In snippet from control/case.ex, there are two spaces between 'File.open("case.ex")' and 'do', both in the code and the output. Should be ...more...
  • Reported in: P1.0 (02-Nov-14)
  • Fixed: 29-Dec-15, awaiting book release
#77763
Paper page: 135
I suggest a footnote or explanation stating that CLI == Command Line Interface, as some readers may not be familiar with the acronym. (And thus may wo...more...
Dave Thomas says: I think my readers will be able to work this out :)
  • Reported in: P1.0 (28-Dec-14)
  • Fixed: 30-Dec-15, awaiting book release
#77981
PDF page: 138
At the bottom of the page, the example showcasing pattern matching has an error. A map is bound to the variable `dave`, but subsequent references to t...more...
Dave Thomas says: Actually, the code is correct. The %{state: } = person -> is a pattern match on the whole dave variable.
  • Reported in: P1.0 (21-Dec-14)
  • Fixed: 30-Dec-15, awaiting book release
#77951
PDF page: 139
As printed: mix run -e 'Issues.CLI.run(["-h"])' will not work for me however: mix run -e "Issues.CLI.run(['-h'])" does (note switched single/double qu...more...
Dave Thomas says: That must be a Windows thing. I think you still need the double quotes round the -h, so I suspect the correct Windows fix would be to escape the outer quotes.
  • Reported in: P1.0 (09-Dec-14)
  • Fixed: 30-Dec-15, awaiting book release
#77904
PDF page: 141
HTTPoison changed its `HTTPoison.get()` function in version 0.5.0 to return a tuple instead of a map. This change breaks the `Issues.GithubIssues.fet...more...
Dave Thomas says: Good catch. I updated the example to work with 0.8.0
  • Reported in: P1.0 (14-Sep-15)
  • Fixed: 30-Dec-15, awaiting book release
#78821
PDF page: 143
Github's issue_url is incorrect and returns a 404. "api.github.com/#{user}/#{project}/issues" should actually be "api.github.com/repos/#{user}/#{proj...more...
  • Reported in: P1.0 (01-Jan-15)
  • Fixed: 30-Dec-15, awaiting book release
#78004
PDF page: 145
When convert_to_list_of_hashdicts is discused, it is unclear where the example is supposed to go. Only on page 148 does the reader figure out where th...more...
  • Reported in: P1.0 (04-Dec-14)
#77891
Paper page: 155
When displaying Issues.CLI.process in iex, the first line of the output is printed in a normal typeface up until 'project elixir'. The output is in i...more...
  • Reported in: P1.0 (10-Dec-14)
  • Fixed: 30-Dec-15, awaiting book release
#77905
PDF page: 159
The "ex_doc" dependency alone isn't enough for the `mix docs` command to succeed: it fails, complains about a missing Markdown processor. I had to ad...more...
  • Reported in: P1.0 (10-Dec-14)
  • Fixed: 30-Dec-15, awaiting book release
#77906
PDF page: 159
As of 2 August 2014, ex_doc is available as a Hex package and shows up in hex.pm, so installing it from GitHub (and that too from the master branch wh...more...
  • Reported in: P1.0 (02-Jan-15)
  • Fixed: 30-Dec-15, awaiting book release
#78005
PDF page: 159
While this suggestion has been reported before, it would be interesting to note the `only: :dev` deps option at this point. When I checked Hex for ex_...more...
  • Reported in: P1.0 (15-Sep-15)
  • Fixed: 30-Dec-15, awaiting book release
#78828
PDF page: 162
The comparison output in the "Output is correct" test must include the trailing spaces. While the online file contains these trailing spaces, its not...more...
  • Reported in: P1.0 (23-Dec-14)
  • Fixed: 30-Dec-15, awaiting book release
#77963
Paper page: 174
The spawn/link1.exs example on page 174 includes the line: Process.flag(:trap_exit, true) But that line is not needed in this example. It is la...more...
  • Reported in: P1.0 (23-Dec-14)
  • Fixed: 30-Dec-15, awaiting book release
#77964
Paper page: 177
Really, really, really pedantic... In the monitor1.exs sample, the name of the "sad" routine changed from "sad_function" (in the linkx.exs samples)...more...
  • Reported in: P1.0 (23-Dec-14)
  • Fixed: 30-Dec-15, awaiting book release
#77965
Paper page: 177
In the command line used to run monitor1.exs the suggested line is: $ elixir -r monitor1.exs -e Monitor1.run However, because the last line of m...more...
  • Reported in: Pre1.0 (07-Oct-14)
  • Fixed: 30-Dec-15, awaiting book release
#77564
PDF page: 178

'bahviour' I assume you meant behavior?--Nhu Nguyen

  • Reported in: P1.0 (29-Sep-15)
  • Fixed: 30-Dec-15, awaiting book release
#78865
PDF page: 182

"In our case, we give it the same number, 37, ten times."
The code above it only shows six 37s.--Eric Lathrop

  • Reported in: P1.0 (05-Dec-14)
  • Fixed: 30-Dec-15, awaiting book release
#77896
PDF page: 182
The results you show for running $elixir fib.exs are: [{37, 39088169}, {37, 39088169}, {37, 39088169}, {37, 39088169}, {37, 39088169}, {37, 39088169...more...
  • Reported in: P1.0 (11-Feb-16)
#79849
PDF page: 214
This is a comment about an example used in Managing Process State Across Restarts section. I am wondering if there is a flaw in using a pid of a stash...more...
  • Reported in: P1.0 (23-Dec-14)
#77966
PDF page: 215
The "supervisor diagram" on this page looks very nice in the PDF. The same image in the ebook version (read in iBooks on a Mac) is pretty terrible. ...more...
  • Reported in: P1.0 (11-Feb-16)
#79847
PDF page: 215
On line 4 of the start_link function of the Sequence.Supervisor module, we are passing "initial_number" to the Supervisor.start_link, but the init fun...more...
  • Reported in: P1.0 (18-Jan-15)
#78055
PDF page: 231

The link to the exercise Exercise: OTP-Applications-3 is broken resp. the exercise is not available.--Pierre Sugar

  • Reported in: P1.0 (18-Jan-15)
  • Fixed: 30-Dec-15, awaiting book release
#78054
PDF page: 266

Using Elixir 1.0.2 here, and IO.ANSI.escape looks like it may no longer exist. IO.ANSI.format works just dandy, however.
--Armando Di Cianno

  • Reported in: P1.0 (10-Nov-14)
  • Fixed: 30-Dec-15, awaiting book release
#77792
PDF page: 268
In "Implementing a Protocol", You need to change iolist_to_binary to IO.iodata_to_binary, since that's what is in the source code now and iolist_to_bi...more...
  • Reported in: P1.0 (18-Jan-15)
  • Fixed: 30-Dec-15, awaiting book release
#78057
PDF page: 269
The output of the example code on this page seems to be incorrect, and this may changed from a previous case before Elixir 1.0.2. HashDict does not...more...
  • Reported in: Pre1.0 (10-Oct-14)
  • Fixed: 30-Dec-15, awaiting book release
#77600
Paper page: 271

Thats what the @fallback_to_any line does. -> That's what the @fallback_to_any line does.--Benjamin Tan

  • Reported in: P1.0 (26-Dec-14)
  • Fixed: 30-Dec-15, awaiting book release
#77973
Paper page: 272
On the page, when describing the way the code recognizes the construct 'fifty[bit]' it says that: ---- <<the mechanism handling the construct>> th...more...
  • Reported in: P1.0 (18-Jan-15)
  • Fixed: 31-Dec-15, awaiting book release
#78058
PDF page: 276
This page has the following near the top. >>> IO.inspect fifty # => %Bitmap{50=0110010} IO.inspect fifty, structs: false # => %{__struct__: Bitmap,...more...
  • Reported in: P1.0 (19-Jan-15)
  • Fixed: 31-Dec-15, awaiting book release
#78059
PDF page: 276
Bitmap.new(value: 12345678901234567890) does not work (likely changed by elixir 1.0.2 time-frame). Standard struct type creation works, though: %Bi...more...
  • Reported in: P1.0 (19-Jan-15)
  • Fixed: 31-Dec-15, awaiting book release
#78060
PDF page: 281

binary_to_atom needs to change to String.to_atom in the example code--Armando Di Cianno

  • Reported in: P1.0 (25-Jan-15)
  • Fixed: 31-Dec-15, awaiting book release
#78083
PDF page: 290
The `raise` in the code example, which is used to re-raise the exception seems to now need to literally be Kernel.reraise/3 (although the /2 form shou...more...
  • Reported in: Pre1.0 (10-Oct-14)
  • Fixed: 31-Dec-15, awaiting book release
#77590
Paper page: 298

These same benefits can aso apply to Elixir code. (aso -> also)--Benjamin Tan

  • Reported in: P1.0 (20-Aug-15)
  • Fixed: 31-Dec-15, awaiting book release
#78775
PDF page: 301
In the example output for the program tasks/anagrams.exs, the result is a 7-element list of anagrams for the word "organ." My program returns 9 anagra...more...
  • Reported in: Pre1.0 (10-Oct-14)
  • Fixed: 31-Dec-15, awaiting book release
#77591
Paper page: 303

There's no need to manually remove Supervisor, since mix projects by default do not come with the supervisor.ex anymore.--Benjamin Tan

  • Reported in: Pre1.0 (10-Oct-14)
  • Fixed: 31-Dec-15, awaiting book release
#77592
Paper page: 305

Last line: And so it goes ? Either incomplete sentence or missing punctation. --Benjamin Tan

Dave Thomas says: It's a Vonnegut reference :)
  • Reported in: Pre1.0 (10-Oct-14)
  • Fixed: 31-Dec-15, awaiting book release
#77595
Paper page: 306
What happens if we change the call to Simple.count_atoms [[:a, :b], :c]? This should be: What happens if we change the call to NoSpecs.length_pl...more...
  • Reported in: P1.0 (18-Oct-15)
#79021
PDF page: 491
In OTP:Servers > “The VM doesn’t hot-swap code until you explicitly access it by module name. So, to try our new functionality we’ll create a new ser...more...