By Developers, For Developers

Historical errata for Programming Elixir 1.2

PDF PgPaper PgTypeDescriptionFixed onComments
4TYPO

“Installing Elixir” section. “This book assumes you’re using at least ELixir 1.2.” top of page. “ELixir” -> “Elixir”

2016-01-07
36TYPO

“with and Pattern Matching” section, top of page/section.

“That’s where the -> operator comes in. If you use -> instead of = in a with expression,…”

looks like “->” is supposed to be “<-”

2016-01-07
236TYPO

> In Elixir, we version both the application code and the data it operates on. The two are independent—we might go for a dozen code releases without changing any data stuctures.

s/stuctures/structures/

2016-01-07
232ERROR

Very trivial, but it looks like Elixir 1.2’s mix no longer says “Generated sequence.app” but “Generated sequence app”. This affects the output listed on 233 and 234, and also arguably on 232 in the first paragraph of “The Application Specification File.” The text says “You probably noticed that every now and then mix will talk about a file called name.app, where name is your application’s name.” It’s now “name app.”

2016-01-07
233SUGGEST

In 1.2 the output of iex -S mix now ends with these lines.

Consolidated List.Chars
Consolidated String.Chars
Consolidated Collectable
Consolidated Enumerable
Consolidated IEx.Info
Consolidated Inspect

You show them in the new EXRM content, but it might be nice to include them here—and I’d personally love a quick sentence explaining what’s going on with them.

Same kind of output is on page 234, fwiw.

2016-01-07
235ERROR

At the top of 235 in the application snippet, the code currently reads

registered: [ :sequence ]

I believe this should be updated to what is written on page 233:

registered: [ Sequence.Server ]

2016-01-07
235SUGGEST

In this line of code…

Sequence.Supervisor.start_link(Application.get_env(:sequence, :initial_number))

…it wasn’t clear to me where the :sequence atom came from. Through trial and error I eventually figured out it came from mix.exs in the project function, but I think it would be nice to clarify this. The last time we talked about get_env in the book was before we dug into mix.exs.

2016-01-07
241TYPO

> But the next request will reference the module explicitly, and th new code will be loaded.

s/th/the/

2016-01-07
273SUGGEST

> Defining Behaviours
> We define a behaviour using the Elixir Behaviour module, combined with defcall-
back definitions.

Instead of using defcallback (deprecated) you should use @callback, right? wdyt?

2016-01-07
282ERROR

At the end of this page, there is a redefinition of the `Inspect.PID` module:

iex> defimpl Inspect, for: PID do
…> def inspect(pid, _) do
…> “#Process: ” <> iolist_to_binary(:erlang.pid_to_list(pid)) <> “!!”
…> end
…> end

But, this sample create a `CompileError`: (CompileError) iex:4: undefined function iolist_to_binary/1

Just replace `iolist_to_binary` with `:erlang.iolist_to_binary`.

2016-01-08
279TYPO

Exercise: LinkingModules-BehavioursAndUse-1

In the body of the def macro, there’s a quote block that defines the actual
method. It contains
IO.puts “==> call: #{Tracer.dump_definition(unquote(name), unquote(args))}”

Actually the name of the function is `Tracer.dump_defn`

2016-01-08
4SUGGEST

Installing Elixir’s URL( elixir-lang.org/getting_started/1.html ) is 404 Page not found. Update to elixir-lang.org/install.html

2016-01-07
153TYPO

In the first paragraph under the heading “Transformation: Convert Response”, the word “relation” is mis-spelled as “realtion”.

2016-01-07
23OK

divvied -> divided

2016-01-07Divvied is a word...
5TYPO

import_file/1 cited two times in the list

2016-01-07As it is in iex :)
34OK

a or b => a or b

extra space to be removed between or and b

2016-01-07I did it deliberately to line things up :)
155TYPO

In the sentence

> Each config line adds one or more key/value pairs to the given application’s _environment.

There is an extra `_` before the word `environment`.

2016-01-08
23TYPO

The changelog for B1.1 says replacement of defcallback with cllback but should be callback. It’s only in the changelog, not in the actual book, so I’m not sure that this counts as a real error. :)

2016-02-01
27ERROR

The text currently says “Ranges are represented as start..end, where start and end can be values of any type.”

However, help on the module “Range” says that both “start” and “end” must be integers. Here is the excerpt from “iex”: “A range represents a discrete number of values where the first and last values are integers.”

2016-02-01
26TYPO

book says, If an atom starts with a letter, it must be lowercase
but i can create an Atom which starts with a capital letter

```elixir
:fred #=> :fred

i :fred
Term
:fred
Data type
Atom
Reference modules
Atom

:Fred #=> :Fred

i :Fred
Term
:Fred
Data type
Atom
Reference modules
Atom
```

2016-02-01
26SUGGEST

can use Syntax or Railroad diagrams [1] for complicated syntax descriptions
same as the ones used in, Javascript - The good parts by Oreilly

[1] search for Syntax_diagram on wikipedia (cannot add a link here)

2016-01-29I really don't want to suggest the book has complete syntax descriptions—I don't want to be a reference. \n \n
28SUGGEST

The section on references says:

> The function make_ref creates a globally unique reference; no other reference will be
> equal to it. We don’t use references in this book.

Would be nice to mention why the book does not use references ?

2016-02-01We simply didn't need them :)
AllERROR

Code is not formatted properly on the mobi format with this latest release.

2016-07-03We've had some reports, but we can't duplicate this. \n \nCan you say what version Kindle you're using?
110TYPO

that comprehensions work bits => that comprehensions work on bits

2016-02-01
97TYPO

“We’ve already seen lists and dictionaries. There are also things such as ranges, files, dictionaries, and even functions.” should probably be “We’ve already seen lists and dictionaries. There are also things such as ranges, files, and even functions.”

2016-02-01
88ERROR

At the top of the page, it states that “…you have to use the Dict.put_new/3 function.” to add a new key to a map. Shouldn’t one use Map.put_new/3 with the release of Elixir 1.2?

2016-02-01
125TYPO

The function signature of `rjust` should be `rjust(str, new_length, padding \\\\ 32)`.

2016-02-01
44SUGGEST

In “Functions Remember Their Original Environment”, the example uses a variable defined in an outer function inside an inner function and describes how this works. In the section immediately preceding, “Pinned Values and Function Parameters”, a variable from an outer function is used in an inner function. I suggest reversing the order of the two sections.

2016-02-01
98TYPO

An example on this page reads:

“”"
iex> Enum.sort [“there”, “was”, “a”, “crooked”, “man”],
…> &(String.length(&1) <= String.length(&2))
[“a”, “man”, “was”, “there”, “crooked”]
“”"

The example output indicates that the sort was not stable. However, subsequently on page 100.

“”"
A Note on Sorting
In our example of sort, we used
iex> Enum.sort [“there”, “was”, “a”, “crooked”, “man”],
…> &(String.length(&1) <= String.length(&2))
It’s important to use <= and not just < if you want the sort to be stable.
“”"

Indeed, when I try it myself the sort is stable with this code.

2016-02-01
225OK

If I followed correctly, line 4 should be

Supervisor.start_link(MODULE, [])

and not

Supervisor.start_link(MODULE, [initial_number])

as the initial_number is not used in the supervisor init function.

Of course, it works as it is, but is a little confusing.

2016-02-01Our init() function still takes a parameter (which we ignore), so we have to pass it on start_link.
86SUGGEST

Out of the blue, list comprehensions and cond expressions are used. I didn’t see either of these referenced previously.

2016-02-01
148TYPO

“But the built-in libraries don’t have what you need”

Should be:
“But if the built-in libraries don’t have what you need”

2016-02-01
226TYPO

At the very bottom of the page, the word “spawn” and “on” need a space between them:

Current text is:
“spawnon page 183.”

2016-02-01
227SUGGEST

It’s suggested to call “mix new —sup sequence”, but that’s a bit confusing since you’ll have to either start over with your sequence project (first blowing away the directory) or hit “y” a bunch of times as mix asks if you want to overwrite a bunch of the existing files.

2016-02-01
224TYPO

“Now we need to set up the initial release and it’s directory structure”

Should be “its”.

2016-02-01
274TYPO

“defined ner the top” the word “near” is missing a letter.

2016-02-15
276OK

Formatting on the page is way off. After the tracer.ex code there is over half of a blank page before it continues.

2016-02-15The book has not yet been through layout :)
275SUGGEST

In the “Use and using” section, the attribute “behaviour" should also be mentioned so that the reader understands why "use" seems to replace "behaviour” when using some modules like GenServer.

2016-02-15To be honest, I think that would cloud the issue somewhat. @behavior in this context is something of a throwback...
159ERROR

The `with` statement doesn’t work: (SyntaxError) lib/issues/table_formatter.ex:9: syntax error before: do

I’ve been told that the `with` statement can be deleted altogether.

2016-07-03What version of Elixir are you running?
250ERROR

The example “tasks/agent_dict.exs” uses the Dict module, which has been deprecated.

2016-02-15
251ERROR

“tasks/anagrams.exs” uses the deprecated Dict module.

2016-02-15
1OK

This is likely me missing something, but I couldn’t figure out where to ask this as a question:

In the fibonacci code, schedule_processes method

if length(processes) > 1 do
schedule_processes(List.delete(processes, pid), queue, results)
else
Enum.sort(results, fn {n1, }, {n2,} -> n1 <= n2 end
end

Shouldn’t the Enum sort branch also delete the last process? It seems like the last process is never dereferenced. That said, I’m not sure how it matters, since we don’t seem to be killing the spawned processes, just removing the references to them.

2016-02-15I think the code is right as it stands. \n \nThe test for `> 1` means that there are still running processes—one is the one we're about to shutdown, and at least one other. In that case, we loop (recurse) having removed the one we shut down. \n \nOtherwise, the scheduler just exits. \n \n(These are good discussions to have in the book's forums)
165158SUGGEST

On page 158 you add the restriction on the number of lines. Initially the variable count was written _count as we were not using it. Not it’s useful and has to be changed to count. The code is correct but it’s easy to forget to rename that while focusing on the Enum.take part.

def process({user, project, _count}) do

2016-07-03
171164ERROR

Logging the error on page 164 does not always work. I suppose there is a race condition between the System.halt that follows an error, and the logging which apparently is done asynchronously in a separate app. Sometimes the error log will not show.

172165TYPO

There is a trailing zero that has nothing to do there at the end of the first comment:

identified by each header. That is, each header identifies a column,
and those columns are extracted and printed from the rows.0

2016-07-03
151ERROR

The 2nd handle_response matcher uses the three-underscore variable name twice “_” — which would match improperly. Elixir properly catches this and throws a warning.

2016-07-03
252ERROR

Attempt to connect to node using
`Node.connect :one@FasterAir` fails due to lack of double quotes.

Worked with `Node.connect :“one@FasterAir”`.

2016-07-03Very strange, because it works OK here
35SUGGEST

in the regular expression for with-scope.exs program,

should the leading underscore (_) be omitted?

So instead of:

~r/_lp:.*?:(\\d):(\\d)/

shouldn’t it be:

~r/lp:.*?:(\\d):(\\d)/

2016-07-03Not on my system :) \n \n \n21∙46∙45≻ grep lp /etc/passwd \n \n/etc/passwd:18:_lp:*:26:26:Printing Services:/var/spool/cups:/usr/bin/false \n \n
106OK

enum/countdown.exs doesn’t appear to work. Manually entered the code, error’d out, copied the code from the link, same error.

(BadArityError) &Countdown.each/2 with arity 2 called with 1 argument (“8”)
(elixir) lib/stream.ex:327: anonymous fn/4 in Stream.each/2
(elixir) lib/stream.ex:1101: Stream.do_resource/5
(elixir) lib/stream.ex:1247: Enumerable.Stream.do_each/4
(elixir) lib/enum.ex:2066: Enum.take/2

2016-07-03Seems to work find here
allERROR

Code examples are mangled with leading spacing missing in .mobi version. Been this way for a for a few edition. For reference I am using the latest (4.18) version of the iOS Kindle App (on my iPad if that is relevant).

2016-07-03
25%ERROR

Can’t say the page I’m reading on Kindle. On `Updating a Map` for add a new key, the example still using Dict.put_new which is deprecated in elixir 1.2. Instead should be Map.put_new(map, key, value)

2016-07-03
217TYPO

last paragraph, missing space in “spawnon page 179”
should be: spawn on page 179

2016-07-03
222SUGGEST

Sequence.SubSupervisor lives in sequence/lib/sequence/subsupervisor.ex. Based on casing and filename conventions, I would expect either the filename to be sub_supervisor.ex or the module name to be Sequence.Subsupervisor..

2016-07-03
236ERROR

After “Now let’s upgrade the running code,” the command should have “$ ssh localhost ~/deploy/bin/sequence upgrade 0.0.2” to be consistent with the rest of the section. It is missing “ssh localhost”

2016-07-03
233TYPO

“we’re now ready to create of first release” should be “we’re now ready to create our first release”

2016-07-03
76SUGGEST

in lists/weather3.exs file:

in first function maybe or should be _target_loc instead of target_loc, otherwise we get a warning “variable target_loc is unused”

2016-07-03
28TYPO

At the bottom of the page, you use the exact same example twice in a row. I would only show:

iex> {1, fred: 1, dave: 2}

once.

2016-07-03One example has `[ ]` and the other has `{ }`
141SUGGEST

HI guys, just a quick suggestion

I named the test file cli_tests.exs (tests with an s) and “mix test” would not run it until I changed it to cli_test.exs (test, singular). Might be worth to point this out to others?

2016-07-03Good idea
xxERROR

Pictures are incorrect in the .mobi version, almost all show the Observer GUI:
onedrive.live.com/redir?resid=F160B95069BB280AObowjrsCnEsUrs&v=3&ithint=photo%2cjpg
onedrive.live.com/redir?resid=F160B95069BB280AEfvdPgAWGDPY1A&v=3&ithint=photo%2cjpg

2016-07-03
45SUGGEST

There is a rnd function about halfway down the page that was a bit confusing. This function is defined twice to show that the order of arguments matters for function referencing (&Float.round/2), but the function is not used. When I first tried to use the function, I wasn’t sure what the &1 and &2 values were supposed to be. I ended up trying things like rnd.(12.4123, 16.231). After referencing the Elixir docs, I see that this takes a float as the first parameter and the length to which you want to round the first parameter as the second parameter. That makes a lot more sense than what I was trying.

This was a small hiccup that lead me off the book and into the docs to find out what it did. If that’s what you were going for, it worked! But at first, it confused me. Just thought I’d share.

2016-07-03
41OK

I’m not sure it’s correct to say that this is a FizzBuzz implementation with no conditional logic. Just because the language has the conditional logic built in via the pattern matching on the argument list doesn’t mean it isn’t there. The language is still conditionally calling one of those function bodies depending on the argument values. If you were to write tests for this function, would they not look essentially the same as they would in a language using explicit conditional logic?

2016-07-03
230ERROR

The generated sequence.app file in the book differs in three respects from the one I generated. I am using Elixir 1.2.4 on OS X 10.11.4. The mod tuple in your listing has

{mod,{’Elixir.Sequence’,[]}}

while mine has

{mod,{’Elixir.Sequence’,456}}

The registered tuple in your listing has

{registered,[sequence]}

while mine has

{registered,[‘Elixir.Sequence.Server’]}

Also, I don’t have an env tuple at all.

My complete sequence.app file looks like:

{application,sequence,
[{description,“sequence”},
{mod,{’Elixir.Sequence’,456}},
{registered,[‘Elixir.Sequence.Server’]},
{vsn,“0.0.1”},
{modules,[‘Elixir.Sequence’,‘Elixir.Sequence.Server’,
‘Elixir.Sequence.Stash’,
‘Elixir.Sequence.SubSupervisor’,
‘Elixir.Sequence.Supervisor’]},
{applications,[kernel,stdlib,elixir]}]}

I am not sure if this is a difference between Elixir 1.2.0 and 1.2.4 or not.

2016-07-03I don't see that here.
237SUGGEST

At the bottom of the page, after the “Migrating Server State” heading, the iex output for Sequence.Server.next_number should be “The next number is 462” instead of 462 as we are now running release 0.0.2.

2016-07-03
244OK

In the source listing for tasks2.exs, the definition of the Fib module is missing.

2016-07-03Deliberate, but I've added a note.
57SUGGEST

The example would be a bit clearer with:

filing = prepare_filing(task, 2013)

… as the one liner later uses this 2013 parameter.

2016-07-03
57SUGGEST

Sorry, regarding my previous errata submission, I read it badly (and this proves how useful the pipe operator is instead!)

It’s just about replacing “2013” with “2016” instead.

2016-07-03
87SUGGEST

Just a little confusing here when the heading mentions Pattern Matching can’t bind keys, then below it says Maps do not allow you to bind a value to a key. With the example, I think what is being conveyed is that the key 2 is being pattern matched to state. That’s why the value :error is bound to state. Then in the next example, the key item is not able to bind with the key 1. Have I understood this correctly?

Pattern Matching Can’t Bind Keys
Maps do not allow you to bind a value to a key during pattern matching.
Thus, you can write this:
iex> { 2 => state } ={ 1 => :ok, 2 => :error }
%{1 => :ok, 2 => :error}
iex> state
:error
but not this:
iex> { item => :ok } ={ 1 => :ok, 2 => :error }

(CompileError) iex:5: illegal use of variable item in map key…

2016-07-03I think it's OK as it stands.
112ERROR

Using Elixir 1.2.4, the heredoc notation just removes the trailing newline, but it keeps the indentation.

```
➔ elixir heredocs.exs
start
my
string
end
```

2016-07-03Seems to work OK fine here. \n \nIs it possible you didn't indent the closing quotes?
143ERROR

The link on Exercise: OrganizingAProject-1 is returning a 500 Internal Server error.

2016-07-03
147ERROR

When handling error response codes (like, for a repo that does not exist and we get a 404), I get a “no function clause matching”.

I think Elixir is trying to match “_” (triple underscore) both with :ok and with 404.

This does not happen if I use a single underscore.

2016-07-03
237TYPO

“wildly successfully sequence-server business” => “wildly successful …”

2016-07-03
292TYPO

IO.inspect fifty # => %Bitmap{50=0110010}
IO.inspect fifty, structs: false # => %{struct: Bitmap, value: 50}

And right below it says:

“There’s a wrinkle here. If you pass structs: true to IO.inspect (or Kernel.inspect), it never calls our inspect function. Instead, it formats it as a tuple.”

But the sentence contradict the code shown (and I also tested the code in iex). When `structs: true` is passed or nothing is passed it calls custom inspect, when `structs: false` is passed it never calls our inspect function.

2016-07-03
269ERROR

When I run assert 5 < 4 in ExUnit it doesn’t respond with “expected 5 to be less then 4”. The assertion source code doesn’t seem to include any special handling for this response.

File: assertion_test.ex
——————————————-
ExUnit.start()

defmodule AssertionTest do
use ExUnit.Case
test “assertion output” do
assert 5 < 4
end
end

iex(10)> ExUnit.run
ExUnit.run

1) test assertion output (AssertionTest)
assertion_test.ex:4
Assertion with < failed
code: 5 < 4
lhs: 5
rhs: 4
stacktrace:
assertion_test.ex:5

Finished in 14.6 seconds (14.6s on load, 0.00s on tests)
1 test, 1 failure

Randomized with seed 1984
%{failures: 1, skipped: 0, total: 1}

2016-07-03
281TYPO

The heading “Build-In Protocols” should be “Built-In Protocols”

2016-07-03
122ERROR

There are no explanation about “upcase(str)”.
Maybe it is a mistake.

2016-07-03I think it probably doesn't need one :)
245TYPO

> The Frequency module maintains a list of word/frequency pairs in a hashdict.

There is a usage of “hashdict” on 1.2.

2016-07-03
259TYPO

> There’s another way of thinking about this. Using unquote inside a quote …

This paragraph is duplicated with next paragraph.
So this paragraph should be removed.

2016-07-03
311TYPO

> @type variant(type_name, type) = { :variant, type_name, type)

It should be

> @type variant(type_name, type) :: {:variant, type_name, type}

2016-07-03
286TYPO

> Instead, it formats it as a tuple.

Not a tuple, but a struct.

2016-07-03
54TYPO

> default arguments

should be “default parameters”.

2016-07-03
33ERROR

> The `with` expression serves double duty.

There are no “second” duty.

2016-07-03The second duty is the pattern matching. I'll make it clearer.
311ERROR

> Simply use one or more identifiers as parameters on the left side

should be “right” side.

2016-07-03
311SUGGEST

> As the `list` entries show, you can parameterize the types in a new definition.

Using `list(t)` is more easy to understand.

> As the `list(t)` entries show…

2016-07-03
269ERROR

> We define a behaviour with defcallback definitions.

should be “@callback” on 1.2.

In P307, there are also two usages of defcallback.

> defcallback parse(uri_info :: URI.Info.t) :: URI.Info.t
> defcallback default_port() :: integer

2016-07-03
84SUGGEST

> The name of the module becomes the name of the map type. Inside the module, you use the `defstruct` macro to define the map’s characteristics.

In this paragraph, you should use “struct” instead of “map” (map type -> struct type, maps’ characteristics -> struct’s …)

2016-07-03
32ERROR

Chapter 4 - Elixir Basics > Names, Source Files, Conventions, Operators, and So On > Operators > Join operators

list1 — list2 # returns elements in list1 not in list2
as [1,2,3,4,5,1,2,3,4,5] — [1,2,3] returns [4, 5, 1, 2, 3, 4, 5]

I find the wording misleading.

2016-07-03
57TYPO

the second parameter of the sales_tax function should be 2016 instead of 2013 to be coherent with the surrounding text:

filing = prepare_filing(sales_tax(Orders.for_customers(DB.find_customers), 2013))

Context:

You’ve all seen code like this:
people = DB.find_customers
orders = Orders.for_customers(people)
tax = sales_tax(orders, 2016)
filing = prepare_filing(tax)

Bread-and-butter programming. We did it because the alternative was to write

filing = prepare_filing(sales_tax(Orders.for_customers(DB.find_customers), 2013))

and that’s the kind of code that you use to get kids to eat their vegetables.

2016-07-03
74OK

I think it should be read “the initial list must have an even number of elements” instead of “an odd number of elements”.

Context:
The third definition of swap matches a list with a single element. This will happen if we get to the end of the recursion and have only one element left. As we take two values off the list on each cycle, the initial list must have had an odd number of elements.

2016-07-03
122TYPO

In the opening sentence of Chapter 11: String Literals the following is written: “Elixir has two kinds of string: single-quoted and double-quoted.” However, “string” should be changed to “strings.”

286TYPO

>There’s a wrinkle here. If you pass `structs: true` to `IO.inspect` (or
>`Kernel.inspect`), it never calls our `inspect` function. Instead, it
>formats it as a tuple.

It should be `structs: false`.

124TYPO

> Chapter 7 had an exercise …

Chapter 10.

616ERROR

First code example at “More Complex Matches”

iex> list = [ 1, 2, 3 ]
[1,2,3,4]

The correct is:

iex> list = [ 1, 2, 3 ]
[1,2,3]

57TYPO

filing = prepare_filing(sales_tax(Orders.for_customers(DB.find_customers), 2013))

the year needs to be 2016 to be matching the rest of this example.

229?ERROR

(I’m using an e-reader so the page number provided is not accurate, but the form submission forced me to pick something)

In Chapter 13, section “Transformation: Convert Response”, the result of `Poison.Parser.parse` is a list of maps, so the use of `List.keyfind` and the creation of `convert_to_list_of_maps` does not make sense to me. Perhaps at one point, the result of the JSON parse was a list of keyword lists?

6ivTYPO

Possible typo, but P2.0 eBook still claims to be “P1.0—March, 2016” version of book, so now I really don’t know if it’s any different than before. Also, PDF metadata shows Creation and Modification dates as “Mar 7, 2016, 13:27” (I am in MST). [ TL;DR: programming-elixir-1-2.p2_0.pdf, 5.9 MB (5,864,389 bytes), Gerbil #576176 ]

6ivTYPO

…and it seems that your Gerbils just found the issue and pushed the CORRECT version to my Dropbox folder! :-) Very fast!

183ERROR

On page 183 you wrote, “However, if you use Process.monitor … there is a potential race condition — if the other process dies before your monitor call completes, you may not receive a notification.” I don’t believe this is true. Even if Process.monitor is called after the process exits then I still get notified. The following code demonstrates this. Also, the Erlang documentation for :erlang.monitor/2, which is called by Process.monitor/1, seems to confirm this although the wording is strange.

pid = spawn fn -> :timer.sleep(1_000) end
Process.monitor(pid) # process still running

receive do
{:DOWN, _ref, :process, _pid, :normal} ->
IO.puts “notified”
end

pid = spawn fn -> nil end

:timer.sleep(1_000)
Process.monitor(pid) # process has already died

receive do
{:DOWN, _ref, :process, _pid, :noproc} ->
IO.puts “notified even though process had already exited when monitor called”
end

Process.monitor(nil) # monitor value that is not even a PID

receive do
{:DOWN, _ref, :process, _pid, :noproc} ->
IO.puts “notified even though we passed nil to Process.monitor”
end

103SUGGEST

On page 103 at the end of the timer function, the 3rd function passed in the Stream.resource() call is fn _ -> end which produces a warning “an expression is always required on the right side of . Please provide a value after>” in Elixir 1.2 (but not 1.1)

fn _ -> nil end

does not produce a warning

14ERROR

Middle of the page:

Back to the match operator.
iex> list = [ 1, 2, 3 ]
[1, 2, 3, 4]

The return is obviously not [1, 2, 3, 4] but [1, 2, 3]

14TYPO

Back to the match operator.
iex> list = [ 1, 2, 3 ]
[1, 2, 3, 4]
To make the match true, Elixir bound the variable list to the list [1, 2, 3].

It should return [1, 2, 3]

Categories: