Skip to content

Commit e577a80

Browse files
authored
Language cleanup (#68)
1 parent 83911c4 commit e577a80

18 files changed

+24
-25
lines changed

book-src/01-01-read-file-line-by-line.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Read file line by line
22

3-
There is a [`Reader`] type in Zig, which provides various methods to read file, such as `readAll`, `readInt`, here we will use `streamUntilDelimiter` to split lines.
3+
There is a [`Reader`] type in Zig, which provides various methods to read file, such as `readAll`, `readInt`. Here we will use `streamUntilDelimiter` to split lines.
44

55
```zig
66
{{#include ../src/01-01.zig }}

book-src/01-02-mmap-file.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Mmap file
22

3-
Creates a memory map of a file using [mmap](https://man7.org/linux/man-pages/man2/mmap.2.html) and simulates some non-sequential reads from the file. Using a memory map means you just index into a slice rather than dealing with seek to navigate a File.
3+
Creates a memory map of a file using [mmap](https://man7.org/linux/man-pages/man2/mmap.2.html) and simulates some non-sequential reads from the file. Using a memory map means you just index into a slice rather than having to deal with seek to navigate a file.
44

55
```zig
66
{{#include ../src/01-02.zig }}

book-src/01-03-file-modified-24h-ago.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Find files that have been modified in the last 24 hours
22

3-
Gets the current working directory by calling `fs.cwd()`, and then iterate files using `walk()`, which will recursively iterates over a directory.
3+
Gets the current working directory by calling `fs.cwd()`, and then iterates files using `walk()`, which will recursively iterate entries in the directory.
44

5-
For each entries, we check if it's a file, and use `statFile()` to retrieve file's metadata.
5+
For each entry, we check if it's a file, and use `statFile()` to retrieve the file's metadata.
66

77
```zig
88
{{#include ../src/01-03.zig }}

book-src/03-01-elapsed-time.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
### Measure the elapsed time between two code sections
22

3-
[`Instant`] represents a timestamp with respect to the currently executing program that ticks during suspend and can be used to record elapsed time.
3+
[`Instant`] represents a timestamp with respect to the currently executing program that ticks while the program is suspended and can be used to record elapsed time.
44

55
Calling [`std.time.Instant.since`] returns a u64 representing nanoseconds elapsed.
66

7-
This task is common, that there is a [`Timer`] for convenience.
7+
This is such a common task, that there is a [`Timer`] for convenience.
88

99
```zig
1010
{{#include ../src/03-01.zig }}

book-src/04-01-tcp-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ instead of `127.0.0.1`, replace `net.Ip4Address.parse` by
2222
(And connect to something like `ip6-localhost`, depending on the way
2323
your machine is set up.)
2424

25-
The next section will show how to connect this server using Zig code.
25+
The next section will show how to connect to this server using Zig code.

book-src/04-02-tcp-client.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## TCP Client
22

3-
In this example, we demonstrate how to create a TCP client to connect to the server from the previous section.
3+
In this example, we demonstrate creation of a TCP client to connect to the server from the previous section.
44
You can run it using `zig build run-04-02 -- <port>`.
55

66
```zig
@@ -10,4 +10,3 @@ You can run it using `zig build run-04-02 -- <port>`.
1010
By default, the program connects with IPv4. If you want IPv6, use
1111
`::1` instead of `127.0.0.1`, replace `net.Address.parseIp4` by
1212
`net.Address.parseIp6`.
13-

book-src/06-01-rand.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Generate random numbers
22

3-
Generates random numbers with help of a thread-local, cryptographically secure pseudo random number generator [`std.crypto.random`].
3+
Generates random numbers with the help of a thread-local, cryptographically secure pseudo random number generator [`std.crypto.random`].
44

55
```zig
66
{{#include ../src/06-01.zig }}

book-src/07-02-shared-data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Share data between two threads
22

3-
When we want to mutate data shared in different threads, [`Mutex`](**Mut**ually **ex**clusive flag) must be used to synchronize threads, otherwise the result maybe unexpected.
3+
When we want to mutate data shared between threads, [`Mutex`](**Mut**ually **ex**clusive flag) must be used to synchronize threads, otherwise the result maybe unexpected.
44

55
```zig
66
{{#include ../src/07-02.zig}}

book-src/08-01-cpu-count.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Check number of logical cpu cores
22

3-
Shows the number of logical CPU cores in current machine using [`std.Thread.getCpuCount`].
3+
Shows the number of logical CPU cores in the current machine using [`std.Thread.getCpuCount`].
44

55
```zig
66
{{#include ../src/08-01.zig }}

book-src/08-02-external.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# External Command
22

3-
Run external command via [`std.process.Child`], and collect output into `ArrayList` via [pipe].
3+
Run an external command via [`std.process.Child`], and collect output into `ArrayList` via [pipe].
44

55
```zig
66
{{#include ../src/08-02.zig }}

0 commit comments

Comments
 (0)