Want to receive a weekly email containing
the scoop on our new titles along with the
occasional special offer? Just click the button.
(You can always unsubscribe later by editing your
account information).

Give us an email and a password (you can use the password later to log in and
change your preferences). We'll send you a newsletter roughly once a week.

Errata for Programming Elixir

We try to keep our books accurate, but sometimes mistakes creep
in. This page lists the errors submitted by our astute readers.
If you've found a new error, please
submit it.

The latest version of the book is P1.0,
released 10 months 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.

Key:TypoTech. ErrorSuggestionNot a problemNext edition

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

(To find out what version you have, look at the copyright page, a
few pages in from the front of the book. If it says (say)
'Second Printing', then here it'll be P2.0. If there are interim PDF
releases in that printing, they'll be 2.1, 2.2, and so on.)

PDF

Paper

Description

Found in

Fixed in

2

#77682: Table of Contents looks terrible.

Previous versions show the chapters and topics well indented.

In this version, there is no indentation on .epub version.
(I'm using iBooks with Yosemite and Mavericks too.)--Emiliano Mancuso

#77682: Table of Contents looks terrible.
Previous versions show the chapters and topics well indented.
In this version, there is no indentation...more...

P1.0
22-Oct-14

21

#78545: "divvied" should have been "divided"--Srikanth Shreenvas

P1.0
27-Jun-15

32

#77566: arithmetic operators

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

Pre1.0
07-Oct-14

58

#78393: 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.--Gerhard Grasböck

P1.0
02-May-15

62

#77879: 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 arguments of bodyless clause--Ryan Abbott

#77879: 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 an...more...

P1.0
02-Dec-14

64

#77941: 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 simple like:

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

P1.0
12-Dec-14

83

#77925: 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 as symbols" he actually meant /s/symbol/atom.--Stevie Graham

#77925: 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 supp...more...

P1.0
14-Dec-14

88

#77585: The last sentence of the fist paragraph reads: "You
can write something -> aking <- to OO code using structs (or maps) and modules."

It should be: "You
can write something => akin <= to OO code using structs (or maps) and modules.:--Axl Mattheus

#77585: The last sentence of the fist paragraph reads: "You
can write something -> aking <- to OO code using structs (or maps) and modules."
It sh...more...

#77902: 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 Integer before invoking the macro Integer.is_even/1"--Armando Di Cianno

#77902: Before using `Integer.is_even/1` twice in the example, you must `require Integer` in iex, or you get "** (CompileError) iex:16: you must requi...more...

P1.0
09-Dec-14

96

#78464: You have this text there:

"This means that if you are using maps or keyword lists, you can supply the keys as symbols:"

For what I saw until know Elixir calls them "atoms", not "symbols".--Brian Thomas Storti

#78464: You have this text there:
"This means that if you are using maps or keyword lists, you can supply the keys as symbols:"
For what I saw u...more...

P1.0
01-Jun-15

98

#78063: 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, pid}. IO.read cannot take in a tuple and throws an error unless just given the pid.--Jacob Chae

#78063: 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: f...more...

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

P1.0
30-Oct-14

104

#77745: 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

P1.0
30-Oct-14

124

#77997: "true part" at the end of the first example on the page should be formatted as output (blue, in quotes), not as code.--Armando Di Cianno

P1.0
30-Dec-14

124

#77761: 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 quotes and in italics.--Lars Storjord

#77761: 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...more...

P1.0
02-Nov-14

127

#77762: 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 just one space.--Lars Storjord

#77762: 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. Sh...more...

P1.0
02-Nov-14

135

#77763: 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 wonder why the module is called that.)--Lars Storjord

#77763: I suggest a footnote or explanation stating that CLI == Command Line Interface, as some readers may not be familiar with the acronym. (And thu...more...

P1.0
02-Nov-14

138

#77981: 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 that map refer to it as `person`.--Bilal Quadri

#77981: At the bottom of the page, the example showcasing pattern matching has an error. A map is bound to the variable `dave`, but subsequent referen...more...

P1.0
28-Dec-14

139

#77951: 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 quotes).

Elixir 1.0.2
Windows 8.1--W

#77951: 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/d...more...

P1.0
21-Dec-14

141

#77904: 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.fetch()` code presented in the book. To shield myself from this breaking change, I had to provide as stricter version number constraint for HTTPoison in my `mix.exs` file:

#77924: Hi,
with version 0.5 of HTTPoison the response seems to have changed. The example code is broken. I have got it running by changing
def h...more...

P1.0
13-Dec-14

143

#78706: As others have pointed out, HTTPoison.get() in version 0.5 breaks the sample code. To get the sample code working as close to the book's intentions as possible, I had to write my handle_response function as follows.

#78706: As others have pointed out, HTTPoison.get() in version 0.5 breaks the sample code. To get the sample code working as close to the book's inte...more...

P1.0
01-Aug-15

145

#78004: 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 that code should have been placed.--Armando Di Cianno

#78004: 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 ...more...

P1.0
01-Jan-15

155

#77891: 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 italics from that point on.--Trevor Strieber

#77891: 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...more...

P1.0
04-Dec-14

159

#77905: 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 add the suggested `{:earmark, ">= 0.0.0"}` line to my deps() function and then run `mix deps.get` in order for `mix docs` to work correctly.

#77905: The "ex_doc" dependency alone isn't enough for the `mix docs` command to succeed: it fails, complains about a missing Markdown processor. I h...more...

P1.0
10-Dec-14

159

#77906: 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 which might contain unstable code changes) isn't really necessary.

#77906: 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 b...more...

P1.0
10-Dec-14

159

#78005: 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_doc (as others did), and noticed it was available there, I also checked the github project. The example docs suggest the following: `{:earmark, "~> 0.1", only: :dev}, {:ex_doc, "~> 0.6", only: :dev}` (since earmark is a good default choice and one is required to use ex_doc). Using the suggestion from the ex_doc GH project page worked like a charm.--Armando Di Cianno

#78005: 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...more...

P1.0
02-Jan-15

174

#77963: 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 later "revealed" in link3.exs where it makes the spawn_link call interesting

What I did was copy link1.exs to link2.exs then changed the spawn line without realizing I had to remove the Process.flag call in order to get the results shown for link2.exs

My suggestion is to simply remove the line from link1.exs--Scott Thompson

#77963: 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. ...more...

P1.0
23-Dec-14

174

#78013: Not only will trap_exit be introduced soon, later on as @seadynamic8 reported, but it seems 100% unneeded here (simply commenting it out has no discernible effect).--Armando Di Cianno

#78013: Not only will trap_exit be introduced soon, later on as @seadynamic8 reported, but it seems 100% unneeded here (simply commenting it out has n...more...

P1.0
04-Jan-15

174

#78046: `Process.flag(:trap_exit, true)` in `spawn/link1.exs` is useless because you used `spawn` and not `spawn_link` in the example--Gabriele Lana

P1.0
15-Jan-15

174

#77808: The Process.flag(:trap_exit, true) is not introduced yet, until a few pages later. It should be removed.--seadynamic8

P1.0
17-Nov-14

177

#77964: Really, really, really pedantic...

In the monitor1.exs sample, the name of the "sad" routine changed from "sad_function" (in the linkx.exs samples) to "sad_method".

Hazards of being an OO programmer I expect. My suggestion is to change it to sad_function like the others. (unless that would make it even more sad)--Scott Thompson

#77964: Really, really, really pedantic...
In the monitor1.exs sample, the name of the "sad" routine changed from "sad_function" (in the linkx.exs ...more...

P1.0
23-Dec-14

177

#77965: 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 monitor1.exs also includes "Monitor1.run", this causes the run function to be called twice.

I had a similar issue when working with the "link" examples from the previous sections where the suggestion was to call:

$ elixir -r link1.exs

but I had missed the trailing "Link1.run" lines when typing in the samples (so stuff didn't work)

My suggestion would be to make these consistent across the board. Either include the code to invoke the function at the end and leave the "-e" option off the sample command line... or take the line that invokes the function off of the samples and add the "-e" line to all of them.

Which you choose is a matter of style I think.--Scott Thompson

#77965: In the command line used to run monitor1.exs the suggested line is:
$ elixir -r monitor1.exs -e Monitor1.run
However, because the last l...more...

#77966: 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. I would provide a screen shot if I could figure out how to do it.

I don't know if the image on the ebook side can be improved, but it couldn't hurt if it can.--Scott Thompson

#77966: 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 ter...more...

P1.0
23-Dec-14

231

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

P1.0
18-Jan-15

266

#78054: 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

P1.0
18-Jan-15

268

#77792: 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_binary no longer exists.--seadynamic8

#77792: 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 ioli...more...

P1.0
10-Nov-14

269

#78057: 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 match `for: [List, Tuple, BitString]`, so it prints out false, not true.

elixir-lang.org /getting_started /16.html#16.1-protocols-and-structs talks about matching protocol impl for struct types, and using this, we can explicitly add HashDict to the list of matched types.

If I wanted to match `HashSet.new,HashDict.new, %{}, and %{foo: :bar}`, it looks like I'd have to write:

#78057: 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 ...more...

P1.0
18-Jan-15

271

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

Pre1.0
10-Oct-14

272

#77973: On the page, when describing the way the code recognizes the construct 'fifty[bit]' it says that:

----
<<the mechanism handling the construct>> then looks for a module called Bitmap.Access and invokes its 'access' function, passing in the original value and the parameter between the square brackets.
----

It actually calls the function 'get' not 'access'.--Scott Thompson

#77973: On the page, when describing the way the code recognizes the construct 'fifty[bit]' it says that:
----
<<the mechanism handling the constr...more...