Skip to content

Commit 441d92c

Browse files
Fix typos in Getting Started
Co-authored-by: Maria Scott <maria-12648430@hnc-agency.org>
1 parent 6189ca0 commit 441d92c

4 files changed

Lines changed: 82 additions & 83 deletions

File tree

system/doc/getting_started/conc_prog.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ done
7171
```
7272

7373
As shown, the function `say_something` writes its first argument the number of
74-
times specified by second argument. The function `start` starts two Erlang
74+
times specified by the second argument. The function `start` starts two Erlang
7575
processes, one that writes "hello" three times and one that writes "goodbye"
7676
three times. Both processes use the function `say_something`. Notice that a
7777
function used in this way by `spawn`, to start a process, must be exported from
@@ -149,7 +149,7 @@ start() ->
149149
```erlang
150150
1> c(tut15).
151151
{ok,tut15}
152-
2> tut15: start().
152+
2> tut15:start().
153153
<0.36.0>
154154
Pong received ping
155155
Ping received pong
@@ -205,7 +205,7 @@ receive
205205
pattern2 ->
206206
actions2;
207207
....
208-
patternN
208+
patternN ->
209209
actionsN
210210
end.
211211
```
@@ -254,7 +254,7 @@ process "ping":
254254
Ping_PID ! pong
255255
```
256256

257-
Notice how the operator "\!" is used to send messages. The syntax of "\!" is:
257+
Notice how the operator `!` is used to send messages. The syntax of `!` is:
258258

259259
```erlang
260260
Pid ! Message
@@ -283,7 +283,7 @@ Pong_PID ! {ping, self()},
283283
```
284284

285285
`self/0` returns the pid of the process that executes `self/0`, in this case the
286-
pid of "ping". (Recall the code for "pong", this lands up in the variable
286+
pid of "ping". (Recall the code for "pong", this ends up in the variable
287287
`Ping_PID` in the `receive` previously explained.)
288288

289289
"Ping" now waits for a reply from "pong":
@@ -397,7 +397,7 @@ pong ! {ping, self()},
397397
## Distributed Programming
398398
399399
Let us rewrite the ping pong program with "ping" and "pong" on different
400-
computers. First a few things are needed to set up to get this to work. The
400+
computers. First a few things need to be set up to get this to work. The
401401
distributed Erlang implementation provides a very basic authentication mechanism
402402
to prevent unintentional access to an Erlang system on another computer. Erlang
403403
systems which talk to each other must have the same _magic cookie_. The easiest
@@ -438,7 +438,7 @@ Erlang system running on a computer is called an _Erlang node_.
438438
439439
(Note: `erl -sname` assumes that all nodes are in the same IP domain and we can
440440
use only the first component of the IP address, if we want to use nodes in
441-
different domains we use `-name` instead, but then all IP address must be given
441+
different domains we use `-name` instead, but then all IP addresses must be given
442442
in full.)
443443
444444
Here is the ping pong example modified to run on two separate nodes:
@@ -533,7 +533,7 @@ Pong finished
533533
534534
Looking at the `tut17` code, you see that the `pong` function itself is
535535
unchanged, the following lines work in the same way irrespective of on which
536-
node the "ping" process is executes:
536+
node the "ping" process is executed:
537537
538538
```erlang
539539
{ping, Ping_PID} ->
@@ -623,7 +623,7 @@ Before starting, notice the following:
623623
- This example only shows the message passing logic - no attempt has been made
624624
to provide a nice graphical user interface, although this can also be done in
625625
Erlang.
626-
- This sort of problem can be solved easier by use of the facilities in OTP,
626+
- This sort of problem can be solved more easily by using the facilities in OTP,
627627
which also provide methods for updating code on the fly and so on (see
628628
[OTP Design Principles](`e:system:design_principles.md`)).
629629
- The first program contains some inadequacies regarding handling of nodes which
@@ -666,9 +666,6 @@ File `messenger.erl`:
666666
%%% Reply {messenger, logged_on} logon was successful
667667
%%%
668668
%%% To server: {ClientPid, logoff}
669-
%%% Reply: {messenger, logged_off}
670-
%%%
671-
%%% To server: {ClientPid, logoff}
672669
%%% Reply: no reply
673670
%%%
674671
%%% To server: {ClientPid, message_to, ToName, Message} send a message
@@ -697,7 +694,7 @@ server_node() ->
697694
messenger@super.
698695
699696
%%% This is the server process for the "messenger"
700-
%%% the user list has the format [{ClientPid1, Name1},{ClientPid22, Name2},...]
697+
%%% the user list has the format [{ClientPid1, Name1},{ClientPid2, Name2},...]
701698
server(User_List) ->
702699
receive
703700
{From, logon, Name} ->
@@ -734,7 +731,7 @@ server_logoff(From, User_List) ->
734731
lists:keydelete(From, 1, User_List).
735732
736733
737-
%%% Server transfers a message between user
734+
%%% Server transfers a message between users
738735
server_transfer(From, To, Message, User_List) ->
739736
%% check that the user is logged on and who he is
740737
case lists:keysearch(From, 1, User_List) of
@@ -894,7 +891,7 @@ call. This would result in the process getting bigger and bigger for every loop.
894891
895892
Functions in the `lists` module are used. This is a very useful module and a
896893
study of the manual page is recommended (`erl -man lists`).
897-
`lists:keymember(Key,Position,Lists)` looks through a list of tuples and looks
894+
`lists:keymember(Key,Position,List)` looks through a list of tuples and looks
898895
at `Position` in each tuple to see if it is the same as `Key`. The first element
899896
is position 1. If it finds a tuple where the element at `Position` is the same
900897
as `Key`, it returns `true`, otherwise `false`.
@@ -986,7 +983,7 @@ From ! {messenger, stop, you_are_not_logged_on}
986983
987984
This is received by the client, which in turn does [`exit(normal)`](`exit/1`)
988985
and terminates. If `keysearch` returns `{value,{From,Name}}` it is certain that
989-
the user is logged on and that his name (peter) is in variable `Name`.
986+
the user is logged on and that their name (peter) is in the variable `Name`.
990987
991988
Let us now call:
992989

system/doc/getting_started/records_macros.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ introduced:
5959
%%% Configure the location of the server node,
6060
-define(server_node, messenger@super).
6161

62-
%%%----END FILE----
62+
%%%----END FILE-----
6363
```
6464

6565
```erlang
@@ -89,7 +89,7 @@ introduced:
8989
-record(message_to,{to_name, message}).
9090
%%% logoff
9191

92-
%%%----END FILE----
92+
%%%----END FILE-----
9393
```
9494

9595
```erlang
@@ -135,7 +135,7 @@ message(ToName, Message) ->
135135
ok
136136
end.
137137

138-
%%%----END FILE----
138+
%%%----END FILE-----
139139
```
140140

141141
```erlang
@@ -178,7 +178,7 @@ await_result() ->
178178
exit(timeout)
179179
end.
180180

181-
%%%----END FILE---
181+
%%%----END FILE----
182182
```
183183

184184
```erlang
@@ -194,7 +194,7 @@ server() ->
194194
process_flag(trap_exit, true),
195195
server([]).
196196

197-
%%% the user list has the format [{ClientPid1, Name1},{ClientPid22, Name2},...]
197+
%%% the user list has the format [{ClientPid1, Name1},{ClientPid2, Name2},...]
198198
server(User_List) ->
199199
io:format("User list = ~p~n", [User_List]),
200200
receive
@@ -230,7 +230,7 @@ server_logon(From, Name, User_List) ->
230230
server_logoff(From, User_List) ->
231231
lists:keydelete(From, 1, User_List).
232232

233-
%%% Server transfers a message between user
233+
%%% Server transfers a message between users
234234
server_transfer(From, To, Message, User_List) ->
235235
%% check that the user is logged on and who he is
236236
case lists:keysearch(From, 1, User_List) of
@@ -250,7 +250,7 @@ server_transfer(From, Name, To, Message, User_List) ->
250250
From ! #server_reply{message=sent}
251251
end.
252252

253-
%%%----END FILE---
253+
%%%----END FILE----
254254
```
255255

256256
## Header Files
@@ -269,7 +269,7 @@ for example:
269269
```
270270

271271
In the case above the file is fetched from the same directory as all the other
272-
files in the messenger example. (_manual_).
272+
files in the messenger example. (_manual_)
273273

274274
.hrl files can contain any valid Erlang code but are most often used for record
275275
and macro definitions.
@@ -297,7 +297,7 @@ This is equivalent to:
297297
Creating a record is best illustrated by an example:
298298

299299
```erlang
300-
#message_to{message="hello", to_name=fred)
300+
#message_to{message="hello", to_name=fred}
301301
```
302302

303303
This creates:
@@ -306,8 +306,8 @@ This creates:
306306
{message_to, fred, "hello"}
307307
```
308308

309-
Notice that you do not have to worry about the order you assign values to the
310-
various parts of the records when you create it. The advantage of using records
309+
Notice that you do not have to worry about the order in which you assign values to the
310+
various parts of a record when you create it. The advantage of using records
311311
is that by placing their definitions in header files you can conveniently define
312312
interfaces that are easy to change. For example, if you want to add a new field
313313
to the record, you only have to change the code where the new field is used and
@@ -358,7 +358,7 @@ This is a standard macro (that is, defined by the system, not by the user).
358358
of using macros with, for example, [parameters](macros.md#defining-and-using-macros).
359359

360360
The three Erlang (`.erl`) files in the messenger example are individually
361-
compiled into object code file (`.beam`). The Erlang system loads and links
361+
compiled into object code files (`.beam`). The Erlang system loads and links
362362
these files into the system when they are referred to during execution of the
363363
code. In this case, they are simply put in our current working directory (that
364364
is, the place you have done "cd" to). There are ways of putting the `.beam`

system/doc/getting_started/robustness.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Several things are wrong with the messenger example in
2525
[A Larger Example](conc_prog.md#ex). For example, if a node where a user is
2626
logged on goes down without doing a logoff, the user remains in the server's
2727
`User_List`, but the client disappears. This makes it impossible for the user to
28-
log on again as the server thinks the user already is logged on.
28+
log on again as the server thinks the user is already logged on.
2929

3030
Or what happens if the server goes down in the middle of sending a message,
3131
leaving the sending client hanging forever in the `await_result` function?
@@ -115,7 +115,7 @@ is canceled if `{ping,Ping_PID}` is received. If `{ping,Ping_PID}` is not
115115
received, the actions following the time-out are done after 5000 milliseconds.
116116
`after` must be last in the `receive`, that is, preceded by all other message
117117
reception specifications in the `receive`. It is also possible to call a
118-
function that returned an integer for the time-out:
118+
function that returns an integer for the time-out:
119119

120120
```erlang
121121
after pong_timeout() ->
@@ -221,7 +221,7 @@ sent to "pong", which also terminates.
221221

222222
It is possible to modify the default behaviour of a process so that it does not
223223
get killed when it receives abnormal exit signals. Instead, all signals are
224-
turned into normal messages on the format `{'EXIT',FromPID,Reason}` and added to
224+
turned into normal messages of the format `{'EXIT',FromPID,Reason}` and added to
225225
the end of the receiving process' message queue. This behaviour is set by:
226226

227227
```erlang
@@ -346,7 +346,7 @@ server_node() ->
346346
messenger@super.
347347

348348
%%% This is the server process for the "messenger"
349-
%%% the user list has the format [{ClientPid1, Name1},{ClientPid22, Name2},...]
349+
%%% the user list has the format [{ClientPid1, Name1},{ClientPid2, Name2},...]
350350
server() ->
351351
process_flag(trap_exit, true),
352352
server([]).
@@ -387,7 +387,7 @@ server_logoff(From, User_List) ->
387387
lists:keydelete(From, 1, User_List).
388388

389389

390-
%%% Server transfers a message between user
390+
%%% Server transfers a message between users
391391
server_transfer(From, To, Message, User_List) ->
392392
%% check that the user is logged on and who he is
393393
case lists:keysearch(From, 1, User_List) of
@@ -469,10 +469,10 @@ unreachable for one of the following reasons:
469469
- The user has logged off (the "logoff" message is removed).
470470
- The network connection to the client is broken.
471471
- The node on which the client process resides has gone down.
472-
- The client processes has done some illegal operation.
472+
- The client process has done some illegal operation.
473473

474474
If an exit signal is received as above, the tuple `{From,Name}` is deleted from
475-
the servers `User_List` using the `server_logoff` function. If the node on which
475+
the server's `User_List` using the `server_logoff` function. If the node on which
476476
the server runs goes down, an exit signal (automatically generated by the
477477
system) is sent to all of the client processes:
478478
`{'EXIT',MessengerPID,noconnection}` causing all the client processes to

0 commit comments

Comments
 (0)