From 27461a400fc85180ebaa69c02003b3d387f8d120 Mon Sep 17 00:00:00 2001 From: Tom Benner Date: Sat, 27 Dec 2014 14:44:49 -0500 Subject: Add an apostrophe to contractions of "let us" --- system/doc/getting_started/seq_prog.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system') diff --git a/system/doc/getting_started/seq_prog.xml b/system/doc/getting_started/seq_prog.xml index be43e8d896..2260229560 100644 --- a/system/doc/getting_started/seq_prog.xml +++ b/system/doc/getting_started/seq_prog.xml @@ -115,7 +115,7 @@ double(X) -> entered and there will also be error messages to give you some idea as to what has gone wrong so you can change what you have written and try again.

-

Now lets run the program.

+

Now let's run the program.

 4> tut:double(10).
 20
@@ -846,7 +846,7 @@ reverse([], [3,2,1]) => write a list manipulating function it is a good idea to check that one isn't already written for you. (see lists(3)).

-

Now lets get back to the cities and temperatures, but take a more +

Now let's get back to the cities and temperatures, but take a more structured approach this time. First let's convert the whole list to Celsius as follows and test the function:

@@ -1268,7 +1268,7 @@ map(Fun, []) -> #Fun<erl_eval.5.123085357> 89> lists:map(Add_3, [1,2,3]). [4,5,6] -

Now lets print out the temperatures in a list of cities (yet +

Now let's print out the temperatures in a list of cities (yet again):

 90> Print_City = fun({City, {X, Temp}}) -> io:format("~-15w ~w ~w~n",
-- 
cgit v1.2.3


From 59ce273905f74f5dc435e821dd62944c7a6ea3f7 Mon Sep 17 00:00:00 2001
From: Tom Benner 
Date: Sat, 27 Dec 2014 14:52:20 -0500
Subject: Move periods inside parenthetical sentences

---
 system/doc/getting_started/conc_prog.xml |  4 ++--
 system/doc/getting_started/seq_prog.xml  | 14 +++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)

(limited to 'system')

diff --git a/system/doc/getting_started/conc_prog.xml b/system/doc/getting_started/conc_prog.xml
index 15feaa9044..9a08d38d7f 100644
--- a/system/doc/getting_started/conc_prog.xml
+++ b/system/doc/getting_started/conc_prog.xml
@@ -253,7 +253,7 @@ Pong_PID ! {ping, self()},
     

self() returns the pid of the process which executes self(), in this case the pid of "ping". (Recall the code for "pong", this will land up in the variable Ping_PID in - the receive previously explained).

+ the receive previously explained.)

"Ping" now waits for a reply from "pong":

receive @@ -385,7 +385,7 @@ $ erl -sname my_name
IP domain and we can use only the first component of the IP address, if we want to use nodes in different domains we use -name instead, but then all IP address must be given in - full.

+ full.)

Here is the ping pong example modified to run on two separate nodes:

diff --git a/system/doc/getting_started/seq_prog.xml b/system/doc/getting_started/seq_prog.xml index 2260229560..dede41d3af 100644 --- a/system/doc/getting_started/seq_prog.xml +++ b/system/doc/getting_started/seq_prog.xml @@ -62,7 +62,7 @@ Eshell V5.9.1 (abort with ^G) (See the chapter "tty - A command line interface" in ERTS User's Guide).

(Note: you will find a lot of line numbers given by the shell out of sequence in this tutorial as it was written and the code - tested in several sessions).

+ tested in several sessions.)

Now let's try a more complex calculation.

 2> (42 + 77) * 66 / 3.
@@ -345,7 +345,7 @@ convert_length({inch, Y}) ->
 [2,3,4,5]

We use | to separate the first elements of the list from the rest of the list. (First has got value 1 and - TheRest value [2,3,4,5]).

+ TheRest value [2,3,4,5].)

Another example:

 20> [E1, E2 | R] = [1,2,3,4,5,6,7].
@@ -403,7 +403,7 @@ list_length([First | Rest]) ->
       the remaining elements Rest is 1 + the length of
       Rest.

(Advanced readers only: This is not tail recursive, there is a - better way to write this function).

+ better way to write this function.)

In general we can say we use tuples where we would use "records" or "structs" in other languages and we use lists when we want to represent things which have varying sizes, (i.e. where we would @@ -673,7 +673,7 @@ ok

Now we call format_temps(Rest) with the rest of the list as an argument. This way of doing things is similar to the loop constructs in other languages. (Yes, this is recursion, but don't - let that worry you). So the same format_temps function is + let that worry you.) So the same format_temps function is called again, this time City gets the value {cape_town,{f,70}} and we repeat the same procedure as before. We go on doing this until the list becomes empty, i.e. [], @@ -738,11 +738,11 @@ list_max([Head|Rest], Result_so_far) ->

Some useful operators in guards are, < less than, > greater than, == equal, >= greater or equal, =< less or equal, /= not equal. (see the chapter - "Guard Sequences" in the Erlang Reference Manual).

+ "Guard Sequences" in the Erlang Reference Manual.)

To change the above program to one which works out the minimum value of the element in a list, all we would need to do is to write < instead of >. (But it would be wise to change - the name of the function to list_min :-).

+ the name of the function to list_min :-).)

Remember that I mentioned earlier that a variable could only be given a value once in its scope? In the above we see, for example, that Result_so_far has been given several values. This is @@ -1201,7 +1201,7 @@ Year rem 400 == 0 -> (see the chapter "Guard Sequences" in the Erlang Reference Manual) (Aside for advanced readers: This is to ensure that guards don't have side - effects). Let's play with a few of these functions in the shell:

+ effects.) Let's play with a few of these functions in the shell:

 75> trunc(5.6).
 5
-- 
cgit v1.2.3


From b397ab65ea094859cab2d31d6444101bc7238b9a Mon Sep 17 00:00:00 2001
From: Tom Benner 
Date: Sat, 27 Dec 2014 14:54:27 -0500
Subject: Use colons before  when appropriate

---
 system/doc/getting_started/conc_prog.xml | 4 ++--
 system/doc/getting_started/seq_prog.xml  | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

(limited to 'system')

diff --git a/system/doc/getting_started/conc_prog.xml b/system/doc/getting_started/conc_prog.xml
index 9a08d38d7f..580ba79403 100644
--- a/system/doc/getting_started/conc_prog.xml
+++ b/system/doc/getting_started/conc_prog.xml
@@ -95,7 +95,7 @@ goodbye
the second a "goodbye", the first another "hello" and so forth. But where did the <0.63.0> come from? The return value of a function is of course the return value of the last "thing" in - the function. The last thing in the function start is

+ the function. The last thing in the function start is:

spawn(tut14, say_something, [goodbye, 3]).

spawn returns a process identifier, or @@ -166,7 +166,7 @@ Pong_PID = spawn(tut15, pong, []) start now creates another process "ping".

spawn(tut15, ping, [3, Pong_PID]), -

this process executes

+

This process executes:

tut15:ping(3, Pong_PID)

<0.36.0> is the return value from the start function.

diff --git a/system/doc/getting_started/seq_prog.xml b/system/doc/getting_started/seq_prog.xml index dede41d3af..6f35c0cccc 100644 --- a/system/doc/getting_started/seq_prog.xml +++ b/system/doc/getting_started/seq_prog.xml @@ -309,7 +309,7 @@ convert_length({inch, Y}) ->

We have shown tuples with two parts above, but tuples can have as many parts as we want and contain any valid Erlang term. For example, to represent the temperature of - various cities of the world we could write

+ various cities of the world we could write:

{moscow, {c, -10}} {cape_town, {f, 70}} @@ -1187,11 +1187,11 @@ trunc(5.0) = 5
 74> 2004 rem 400.
 4
-

so instead of writing

+

so instead of writing:

trunc(Year / 400) * 400 == Year -> leap; -

we could write

+

we could write:

Year rem 400 == 0 -> leap; -- cgit v1.2.3 From a0899e09dc5aede325663a3673163c9ce376bf6f Mon Sep 17 00:00:00 2001 From: Tom Benner Date: Sat, 27 Dec 2014 14:56:21 -0500 Subject: Add a comma after "For example" when appropriate --- system/doc/getting_started/conc_prog.xml | 2 +- system/doc/getting_started/records_macros.xml | 2 +- system/doc/getting_started/robustness.xml | 2 +- system/doc/getting_started/seq_prog.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'system') diff --git a/system/doc/getting_started/conc_prog.xml b/system/doc/getting_started/conc_prog.xml index 580ba79403..0b7111f183 100644 --- a/system/doc/getting_started/conc_prog.xml +++ b/system/doc/getting_started/conc_prog.xml @@ -364,7 +364,7 @@ pong ! {ping, self()},
.erlang.cookie in the directory you get to after executing the command cd without any argument). The .erlang.cookie file should contain one line with - the same atom. For example on Linux or Unix in the OS shell:

+ the same atom. For example, on Linux or Unix in the OS shell:

 $ cd
 $ cat > .erlang.cookie
diff --git a/system/doc/getting_started/records_macros.xml b/system/doc/getting_started/records_macros.xml
index 76e3d185fb..2922962134 100644
--- a/system/doc/getting_started/records_macros.xml
+++ b/system/doc/getting_started/records_macros.xml
@@ -284,7 +284,7 @@ server_transfer(From, Name, To, Message, User_List) ->
       the record is referred to. If you leave out a field when creating
       a record, it will get the value of the atom undefined. (*manual*)

Pattern matching with records is very similar to creating - records. For example inside a case or receive:

+ records. For example, inside a case or receive:

#message_to{to_name=ToName, message=Message} ->

is the same as:

diff --git a/system/doc/getting_started/robustness.xml b/system/doc/getting_started/robustness.xml index 359ea93275..b97940d388 100644 --- a/system/doc/getting_started/robustness.xml +++ b/system/doc/getting_started/robustness.xml @@ -30,7 +30,7 @@

There are several things which are wrong with the messenger example from - the previous chapter. For example if a node where a user is logged + the previous chapter. For example, if a node where a user is logged on goes down without doing a log off, the user will remain in the server's User_List but the client will disappear thus making it impossible for the user to log on again as the server diff --git a/system/doc/getting_started/seq_prog.xml b/system/doc/getting_started/seq_prog.xml index 6f35c0cccc..0bd9f83c73 100644 --- a/system/doc/getting_started/seq_prog.xml +++ b/system/doc/getting_started/seq_prog.xml @@ -325,7 +325,7 @@ convert_length({inch, Y}) -> Lists

Whereas tuples group things together, we also want to be able to represent lists of things. Lists in Erlang are surrounded by "[" - and "]". For example a list of the temperatures of various cities + and "]". For example, a list of the temperatures of various cities in the world could be:

[{moscow, {c, -10}}, {cape_town, {f, 70}}, {stockholm, {c, -4}}, -- cgit v1.2.3 From d57384d0ac779b5a5ab8b5981e86be43b69fd969 Mon Sep 17 00:00:00 2001 From: Tom Benner Date: Sat, 27 Dec 2014 14:57:51 -0500 Subject: Fix typo ("to use to use") --- system/doc/getting_started/seq_prog.xml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'system') diff --git a/system/doc/getting_started/seq_prog.xml b/system/doc/getting_started/seq_prog.xml index 0bd9f83c73..3636b23797 100644 --- a/system/doc/getting_started/seq_prog.xml +++ b/system/doc/getting_started/seq_prog.xml @@ -573,10 +573,9 @@ http://www.erlang.org/doc/r9b/doc/index.html
Writing Output to a Terminal

It's nice to be able to do formatted output in these example, so - the next example shows a simple way to use to use - the io:format function. Of course, just like all other - exported functions, you can test the io:format function in - the shell:

+ the next example shows a simple way to use the io:format + function. Of course, just like all other exported functions, you + can test the io:format function in the shell:

 31> io:format("hello world~n", []).
 hello world
-- 
cgit v1.2.3


From 87cd98eb897c1168d7928764f0140a443be21483 Mon Sep 17 00:00:00 2001
From: Tom Benner 
Date: Sat, 27 Dec 2014 14:59:04 -0500
Subject: Fix grammar and formatting issues

---
 system/doc/getting_started/conc_prog.xml | 6 +++---
 system/doc/getting_started/seq_prog.xml  | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

(limited to 'system')

diff --git a/system/doc/getting_started/conc_prog.xml b/system/doc/getting_started/conc_prog.xml
index 0b7111f183..6c513162c0 100644
--- a/system/doc/getting_started/conc_prog.xml
+++ b/system/doc/getting_started/conc_prog.xml
@@ -170,7 +170,7 @@ spawn(tut15, ping, [3, Pong_PID]),
     
 tut15:ping(3, Pong_PID)
     

<0.36.0> is the return value from the start function.

-

The process "pong" now does:

+

The process "pong" now does:

receive finished -> @@ -235,7 +235,7 @@ Ping_PID ! pong Pid ! Message

I.e. Message (any Erlang term) is sent to the process with identity Pid.

-

After sending the message pong, to the process "ping", +

After sending the message pong to the process "ping", "pong" calls the pong function again, which causes it to get back to the receive again and wait for another message. Now let's look at the process "ping". Recall that it was started @@ -373,7 +373,7 @@ $ chmod 400 .erlang.cookie

The chmod above make the .erlang.cookie file accessible only by the owner of the file. This is a requirement.

When you start an Erlang system which is going to talk to other - Erlang systems, you must give it a name, eg:

+ Erlang systems, you must give it a name, e.g.:

 $ erl -sname my_name

We will see more details of this later. If you want to diff --git a/system/doc/getting_started/seq_prog.xml b/system/doc/getting_started/seq_prog.xml index 3636b23797..699b9487ed 100644 --- a/system/doc/getting_started/seq_prog.xml +++ b/system/doc/getting_started/seq_prog.xml @@ -208,7 +208,7 @@ mult(X, Y) -> called variables. Variables must start with a capital letter (see the chapter "Variables" - in the Erlang Reference Manual). Examples of variable could be + in the Erlang Reference Manual). Examples of variables could be Number, ShoeSize, Age etc.

@@ -271,7 +271,7 @@ convert(N, centimeter) -> Consider:

tut2:convert(3, inch). -

Does this mean that 3 is in inches? or that 3 is in centimeters +

Does this mean that 3 is in inches? Or that 3 is in centimeters and we want to convert it to inches? So Erlang has a way to group things together to make things more understandable. We call these tuples. Tuples are surrounded by "{" and "}".

@@ -736,7 +736,7 @@ list_max([Head|Rest], Result_so_far) -> the next part of the function.

Some useful operators in guards are, < less than, > greater than, == equal, >= greater or equal, =< less or - equal, /= not equal. (see the chapter + equal, /= not equal. (See the chapter "Guard Sequences" in the Erlang Reference Manual.)

To change the above program to one which works out the minimum value of the element in a list, all we would need to do is to @@ -889,7 +889,7 @@ format_temps(List_of_cities) -> [City | convert_list_to_c(Rest)];

We go on doing this until we get to the end of the list (i.e. - the list is empty:

+ the list is empty):

convert_list_to_c([]) -> []. -- cgit v1.2.3