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/doc/getting_started') 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