Errata

Introducing Erlang

Errata for Introducing Erlang, Second Edition

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
PDF Page 11
the return value, after the code

Hi,

The return value i got is different from the book.
#Fun<erl_eval.6.111823515>

the one i got as follows, #Fun<erl_eval.6.52032458>

Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V8.2 (abort with ^G)
1> FallVelocity = fun(Distance) -> math:sqrt(2 * 9.8 * Distance) end.
#Fun<erl_eval.6.52032458>
2>

Anonymous  Jan 24, 2017 
PDF Page 12
the return value, after the code #6 is different

the return value on the book is #Fun<erl_eval.6.111823515>

i got the following return values:-
6> Mps_to_mph =fun(Mps) -> 2.23693629 * Mps end.
#Fun<erl_eval.6.52032458>

values return #7,8, and 9 are correct.

Anonymous  Jan 24, 2017 
PDF Page 12
the return value, after the code #10 is different

value from the book is #Fun<erl_eval.6.111823515>

the one i got is

10> Mps_to_kph =fun(Mps) -> 3.6 * Mps end.
#Fun<erl_eval.6.52032458>

Anonymous  Jan 24, 2017 
PDF Page 19
line 5 of example 2-7 code

on the 2017-01-27: Second Early Release edition.

on line number 5 of the code,:-

%% @author Simon St.Laurent <simonstl@simonstl.com> [http://simonstl.com]
%% @doc Functions calculating velocities achieved by objects
%% dropped in a vacuum.
%% @reference from <a href= "http://shop.oreilly.com/product/0636920025818.do" >
Introducing Erlang</a>,

it should be
%% @author Simon St.Laurent <simonstl@simonstl.com> [http://simonstl.com]
%% @doc Functions calculating velocities achieved by objects
%% dropped in a vacuum.
%% @reference from <a href= "http://shop.oreilly.com/product/0636920025818.do" >
%% Introducing Erlang</a>,

badli  Jan 31, 2017 
24
Chapter 1. Numbers in Erlang

Instead of describing such an error

4> .0000000000000000000000000000023432432432432234232324.
* 1: syntax error before: 23432432432432234232324


the compiler produces the following text

4> .0000000000000000000000000000023432432432432234232324.
* 1: syntax error before: '.'

Anatolii Kosorukov  Nov 01, 2019 
32
Chapter 3. Part "Adding Structure: Tuples"

There is two function to get
The module "erlang" has two functions to get the tuple size. So I think we need to mention them. The author mentioned only one - "tuple_size" at the paragraph:
"... find out how many items are in a tuple with the tuple_size function."

The second is "size". It returns the same value and behave the same.

I think it would be nice to add the link to Erlang documentation in the book when the author mention some function name (at least one time).

Anatolii Kosorukov  Nov 08, 2019 
PDF Page 34
Chapter 3. Part "Processing Tuples"

There is no space between the folder name and the word "More".

quote:
(You can find this at ch03/ex5-tuplesMore.)

I also think that the word "More" would be correct to write in lowercase as "more".

Anatolii Kosorukov  Nov 08, 2019 
PDF Page 34
Chapter 3. Part "Processing Tuples"

The name of a project looks like a typo. I think it would be clear to rename this project "ch03/ex5-tuplesMore" (provide another one).

(You can find this at ch03/ex5-tuplesMore.)

Even ch03/ex5-tuples2 would be better.

Anatolii Kosorukov  Nov 08, 2019 
35
Chapter 2. Part "Module Directives"

Typo:
"Next, you can compile them.."

I would be:
"Next, you can combile them.."

Just change "p" to "b".

Anatoly Kosorukov  Nov 05, 2019 
PDF Page 44
Chapter 4. Part "he Gentlest Side Effect: io:format"

I think there is no need to place a space between the io:format() function and the ";" in the code examples:

io: format ("Look out below! ~ n") ;
io: format ("Look out below! ~ w is too high. ~ n", [Distance]) ;
io: format ("Look out below! ~ w is too high on ~ w. ~ n", [Distance, Planemo]) ;

It would be clear to remove these spaces.

Anatolii Kosorukov  Nov 08, 2019 
PDF Page 45
Chapter 4. Part "Simple Recursion" "Counting Down"

The compiler reports an unused variable in a function (count.erl: 9: Warning: variable 'From' is unused
)

A good solution would be to put an underscore in front of the name of an unused variable:

countdown (_From) ->
io: format ("blastoff! ~ n").

Anatolii Kosorukov  Nov 08, 2019 
PDF Page 50
Chapter 4. Part "Simple Recursion" "Recursing with Return Values"

There is compiler warnings while code compiling (ex12-factorial-up):

1> c(fact).
fact.erl:13: Warning: variable 'Current' is unused
fact.erl:13: Warning: variable 'N' is unused

To fix it add "_" before unused names like this:

factorial(_Current, _N, Result) ->
io:format("Finished.~n"),
Result.

The result of compiling will be

2> c(fact).
{ok,fact}

Anatolii Kosorukov  Nov 08, 2019 
74
Chapter 6. Part "Building a List of Lists"

The short link bit.ly/2lFAvGG provided to rosettastone web site is not worked.
In printed, pdf verstions the link has a type (I think) - just change "’" to "'"

The correct link is
rosettacode.org/wiki/Pascal's_triangle#Erlang
or
rosettacode.org/wiki/Pascal%27s_triangle#Erlang

Anatolii Kosorukov  Nov 11, 2019 
Printed Page 80
2nd last paragraph. 3rd sentence

"... or if you want be more active..."

There should be the word "to" after "be".

"if you want to be more active"

Anonymous  Jan 10, 2020 
PDF Page 93
Chapter 8. Part "Registering a Process"

Note that in code examples after sending a message

3> bounce ! hello.
4> bounce ! "Really?".
8> GetBounce ! "Still there?".

the atom 'ok' will not be printed to the console.

Anatolii Kosorukov  Nov 12, 2019 
PDF Page 97
Chapter 8. Part "Processes Talking Amongst Themselves" last paragraph

The explanation of what is happening is not very clear. (or maybe author wanted to say something that I did not understand). Therefore, other readers might have a misunderstanding of what is happening all the same.

My version of what is happening:

The shell sent a message to Pid1, the process identifier for mph_drop:mph_drop/0:

3> Pid1=spawn(mph_drop,mph_drop,[]).

If this were so, then such a process would have to be launched in this way:

3> Pid1=spawn(mph_drop,convert,[Drop]).

But in the example, it is not so. There is no process that is be identified by mph_drop:convert/1.

Inside this process Pid1, another process was created (It identifier for drop:drop/0). pid of it is stored in the Drop variable and passed to the mph_drop:convert/1 function.

The function mph_drop:convert/1 is function that receives messages which reported them to standard output, in this case the shell.

When the process with id Pid1 receives a response, receive message functionality of the mph_drop:convert/1 function prints a message to the console.

Anatolii Kosorukov  Nov 12, 2019 
PDF Page 98
Chapter 8. Part "Watching Your Processes" Figure 8-2. Observer’s process window, sorted by process name

In paragraph above Figure 8-2 has mph_drop:mph_drop/0 instead of drop:drop/0.

Anatolii Kosorukov  Nov 13, 2019 
99
Chapter 8. Part "Watching Your Processes"

The name of the process which the author offers to find in the table of processes (MphDrop:mph_drop/0) should not begin with a capital letter.

The correct name of the process is "mphDrop:mph_drop/0".

Anatolii Kosorukov  Nov 13, 2019 
102
Chapter 8. Part "Breaking Things and Linking Processes" last paragraph

As you see in the pictures there are two processes "drop:drop/0" and "mph_drop:mph_drop/0". When we entered wrong input data the process "drop:drop/0" was gone and "mph_drop:mph_drop/0" continued to be in working state.

Note that there were no "mph_drop:convert/1" process as you can see at the Figure 8-7.

Anatolii Kosorukov  Nov 13, 2019 
PDF Page 104
Chapter 8. Part "Breaking Things and Linking Processes"

In the note block the two processes are mentioned.
There are mph_drop:mph_drop/0 and drop:drop/0.

There is no drop:drop/1 process in the process table.

So when an error occurs the processes mph_drop:mph_drop/0 and drop:drop/0 or
exit(Pid1,kill) is launched that two processes were gone.

Anatolii Kosorukov  Nov 13, 2019 
PDF Page 106
Chapter 8. Part "Breaking Things and Linking Processes"

Note that you need to compile two (!) files: mph_drop.erl and (!) drop.erl. Without c(drop). command you get that kind of error

1> c(mph_drop).
{ok,mph_drop}
2> Pid1=spawn(mph_drop,mph_drop,[]).
<0.84.0>
FAILURE: <0.85.0> died because of {undef,[{drop,drop,[],[]}]}.
3> =ERROR REPORT==== 14-Nov-2019::07:08:18.234000 ===
Loading of e:/Users/tol_pc/Desktop/erlang/Introducing Erlang/code/ch08/ex9-trapping/drop.beam failed: badfile

=ERROR REPORT==== 14-Nov-2019::07:08:18.234000 ===
beam/beam_load.c(2085): Error loading function drop:fall_velocity/2: op test_heap u u:
please re-compile this module with an 22 compiler


=ERROR REPORT==== 14-Nov-2019::07:08:18.234000 ===
Error in process <0.85.0> with exit value:
{undef,[{drop,drop,[],[]}]}

Anatolii Kosorukov  Nov 13, 2019 
115
Chapter 9. Part "Debugging through a GUI"

When we select a module to analyze “Module” ➜ “Interpret ...” while debugging, we must select the module source code file.

I think, when we simply say "select drop module" it is not precise and unclear.

Anatolii Kosorukov  Nov 14, 2019 
PDF Page 115
Chapter 9. Part "Debugging through a GUI"

In the "Interpret Modules" window select the source code file (drop.erl) and click on the "OK" button.

The "Choose" button on the "Interpret Modules" window does not exist.

Anatolii Kosorukov  Nov 14, 2019 
PDF Page 115
Chapter 9. Part "Debugging through a GUI"

Note that after you clicked on the “OK” button, the module selection window was closed (“Intepret Modules” window). There is no “Done” button that you would have to click to close the “Intepret Modules” window and return to the “Monitor” window.

Everything is much simpler.

Anatolii Kosorukov  Nov 14, 2019 
PDF Page 123
Chapter 9. Part "Debugging through a GUI"

I think that it would be correct to move the Figure 9-12. The function call complete to the end of part "Debugging through a GUI" as the last picture of serias of section's example.

I think it would be would be clear to move Figure 9-12. The function call is completed to the end of the “Debugging through the GUI” part, as the last of the sequence of figures.

Placing it in the part "Tracing Messages" (at the page 124) looks strange .

Anatolii Kosorukov  Nov 14, 2019 
PDF Page 147
Chapter 10. Part "Starting up Mnesia"

Initially, directory with a name like Mnesia.nonode@nohost holds a FALLBACK.BUP file. There are no a LATEST.LOG file and a schema.DAT file.

Anatolii Kosorukov  Nov 16, 2019 
PDF Page 151
Chapter 10. Part "Reading Data"

In a shell after

c(drop).

and before

Pid1=spawn(mph_drop,mph_drop,[]).

we must compile "mph_drop" module too:

c(mph_drop).

Anatolii Kosorukov  Nov 16, 2019 
PDF Page 177
Chapter 12. Part "Community"

The link to github projects written in Erlang is broken (old)

https://github.com/languages/Erlang

To achive that action, please, use advanced search form of Github

https://github.com/search/advanced

Select the language (for instance Erlang) and/or any other parameters and serf

https://github.com/search?utf8=%E2%9C%93&q=language%3AErlang&type=Repositories&ref=advsearch&l=Erlang&l=

Anatolii Kosorukov  Nov 17, 2019 
180
Reserved Words

The list of reserved Erlang words do not contain the word "query".

Full list of reserved wods are here erlang.org/doc/reference_manual/introduction.html

Anatoly Kosorukov  Nov 01, 2019 
180
Reserved Words

In example of quoted reserved word, the word 'received' is not in the list of reserved words. So, it should be changed to 'receive'.

Anatolii Kosorukov  Nov 01, 2019 
PDF Page 192
Table A-8. Operator precedence, from highest to lowest

In a table row:
== /= =< < >= > =:= =/=+

I think the last element "+" is odd (unnecessary).

Anatolii Kosorukov  Nov 01, 2019 
Mobi Page 549
2. Functions and Modules -> Module Directives

I'm using the Kindle version of the 2nd edition.

It states:

---
Examples 2-2 and 2-3, both in ch02/ex2-combined, show how this might be improved.
--

But in the files at https://github.com/simonstl/introducing-erlang-2nd/ there is no ch02/ex2-combined, there is a ch02/ex3-combined - but what is meant here is the directory ch02/ex2-mixing.

Michiel Beijen  Mar 15, 2017