Skip to content

Commit 24d3eef

Browse files
fxnjosevalim
authored andcommitted
Minor details (elixir-lang#909)
1 parent 9b47aaa commit 24d3eef

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

getting-started/erlang-libraries.markdown

+11-11
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ iex> :binary.bin_to_list "Ø"
2929
[195, 152]
3030
```
3131

32-
The above example shows the difference; the `String` module returns UTF-8
32+
The above example shows the difference; the `String` module returns Unicode
3333
codepoints, while `:binary` deals with raw data bytes.
3434

3535
## Formatted text output
@@ -80,9 +80,6 @@ functions for dealing with directed graphs built of vertices and edges.
8080
After constructing the graph, the algorithms in there will help finding
8181
for instance the shortest path between two vertices, or loops in the graph.
8282

83-
Note that the functions in `:digraph` alter the graph structure indirectly
84-
as a side effect, while returning the added vertices or edges.
85-
8683
Given three vertices, find the shortest path from the first to the last.
8784

8885
```iex
@@ -95,6 +92,9 @@ iex> :digraph.get_short_path(digraph, v0, v2)
9592
[{0.0, 0.0}, {1.0, 0.0}, {1.0, 1.0}]
9693
```
9794

95+
Note that the functions in `:digraph` alter the graph structure in-place, this
96+
is possible because they are implemented as ETS tables, explained next.
97+
9898
## Erlang Term Storage
9999

100100
The modules [`ets`](http://erlang.org/doc/man/ets.html) and
@@ -116,15 +116,15 @@ iex> :ets.insert(table, {"China", 1_374_000_000})
116116
iex> :ets.insert(table, {"India", 1_284_000_000})
117117
iex> :ets.insert(table, {"USA", 322_000_000})
118118
iex> :ets.i(table)
119-
<1 > {"USA", 322000000}
120-
<2 > {"China", 1_374_000_000}
121-
<3 > {"India", 1_284_000_000}
119+
<1 > {<<"India">>,1284000000}
120+
<2 > {<<"USA">>,322000000}
121+
<3 > {<<"China">>,1374000000}
122122
```
123123

124124
## The math module
125125

126126
[The `math` module](http://erlang.org/doc/man/math.html) contains common
127-
mathematical operations covering trigonometry, exponential and logarithmic
127+
mathematical operations covering trigonometry, exponential, and logarithmic
128128
functions.
129129

130130
```iex
@@ -174,10 +174,10 @@ iex> :rand.uniform(6)
174174

175175
## The zip and zlib modules
176176

177-
[The `zip` module](http://erlang.org/doc/man/zip.html) lets you read and write zip files to and from disk or memory,
178-
as well as extracting file information.
177+
[The `zip` module](http://erlang.org/doc/man/zip.html) lets you read and write
178+
ZIP files to and from disk or memory, as well as extracting file information.
179179

180-
This code counts the number of files in a zip file:
180+
This code counts the number of files in a ZIP file:
181181

182182
```iex
183183
iex> :zip.foldl(fn _, _, _, acc -> acc + 1 end, 0, :binary.bin_to_list("file.zip"))

getting-started/typespecs-and-behaviours.markdown

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ title: Typespecs and behaviours
1111

1212
Elixir is a dynamically typed language, so all types in Elixir are inferred by the runtime. Nonetheless, Elixir comes with **typespecs**, which are a notation used for:
1313

14-
1. declaring custom data types;
15-
2. declaring typed function signatures (specifications).
14+
1. declaring typed function signatures (specifications);
15+
2. declaring custom data types.
16+
1617

1718
### Function specifications
1819

@@ -35,7 +36,7 @@ Elixir supports compound types as well. For example, a list of integers has type
3536

3637
While Elixir provides a lot of useful built-in types, it's convenient to define custom types when appropriate. This can be done when defining modules through the `@type` directive.
3738

38-
Say we have a `LousyCalculator` module, which performs the usual arithmetic operations (sum, product and so on) but, instead of returning numbers, it returns tuples with the result of an operation as the first element and a random remark as the second element.
39+
Say we have a `LousyCalculator` module, which performs the usual arithmetic operations (sum, product, and so on) but, instead of returning numbers, it returns tuples with the result of an operation as the first element and a random remark as the second element.
3940

4041
```elixir
4142
defmodule LousyCalculator do

getting-started/where-to-go-next.markdown

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ In order to get your first project started, Elixir ships with a build tool calle
1717
$ mix new path/to/new/project
1818
```
1919

20-
We have written a guide that covers how to build an Elixir application, with its own supervision tree, configuration, tests and more. The application works as a distributed key-value store where we organize key-value pairs into buckets and distribute those buckets across multiple nodes:
20+
We have written a guide that covers how to build an Elixir application, with its own supervision tree, configuration, tests, and more. The application works as a distributed key-value store where we organize key-value pairs into buckets and distribute those buckets across multiple nodes:
2121

2222
* [Mix and OTP](/getting-started/mix-otp/introduction-to-mix.html)
2323

@@ -29,7 +29,7 @@ Elixir is an extensible and very customizable programming language thanks to its
2929

3030
## Community and other resources
3131

32-
We have a [Learning](/learning.html) section that suggests books, screencasts and other resources for learning Elixir and exploring the ecosystem. There are also plenty of Elixir resources out there, like conference talks, open source projects, and other learning material produced by the community.
32+
We have a [Learning](/learning.html) section that suggests books, screencasts, and other resources for learning Elixir and exploring the ecosystem. There are also plenty of Elixir resources out there, like conference talks, open source projects, and other learning material produced by the community.
3333

3434
Don't forget that you can also check the [source code of Elixir itself](https://github.com/elixir-lang/elixir), which is mostly written in Elixir (mainly the `lib` directory), or [explore Elixir's documentation](/docs.html).
3535

@@ -41,4 +41,4 @@ Elixir runs on the Erlang Virtual Machine and, sooner or later, an Elixir develo
4141

4242
* Erlang's official website has a short [tutorial](http://www.erlang.org/course/concurrent_programming.html) with pictures that briefly describe Erlang's primitives for concurrent programming.
4343

44-
* [Learn You Some Erlang for Great Good!](http://learnyousomeerlang.com/) is an excellent introduction to Erlang, its design principles, standard library, best practices and much more. Once you have read through the crash course mentioned above, you'll be able to safely skip the first couple of chapters in the book that mostly deal with the syntax. When you reach [The Hitchhiker's Guide to Concurrency](http://learnyousomeerlang.com/the-hitchhikers-guide-to-concurrency) chapter, that's where the real fun starts.
44+
* [Learn You Some Erlang for Great Good!](http://learnyousomeerlang.com/) is an excellent introduction to Erlang, its design principles, standard library, best practices, and much more. Once you have read through the crash course mentioned above, you'll be able to safely skip the first couple of chapters in the book that mostly deal with the syntax. When you reach [The Hitchhiker's Guide to Concurrency](http://learnyousomeerlang.com/the-hitchhikers-guide-to-concurrency) chapter, that's where the real fun starts.

0 commit comments

Comments
 (0)