Skip to content

Commit 0e4df43

Browse files
author
José Valim
committed
Fix erlang file build
1 parent 9cdcbf7 commit 0e4df43

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

getting-started/erlang-libraries.markdown

+22-18
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ layout: getting-started
33
title: Erlang libraries
44
---
55

6-
# {{ page.title }}<span hidden>.</span>
6+
# {{ page.title }}
77

88
{% include toc.html %}
99

@@ -69,8 +69,11 @@ time conversion functions.
6969
```iex
7070
iex> :calendar.day_of_the_week(1980, 6, 28)
7171
6
72-
iex> :calendar.now_to_local_time(:erlang.timestamp)
73-
{{2016, 2, 17}, {22, 4, 55}}
72+
iex> {date, time} = :calendar.now_to_local_time(:erlang.timestamp)
73+
iex> date
74+
{2016, 2, 17}
75+
iex> time
76+
{22, 4, 55}
7477
```
7578

7679
## The crypto module
@@ -134,13 +137,14 @@ side-effect.
134137

135138
```iex
136139
iex> table = :ets.new(:ets_test, [])
137-
iex> :ets.insert(table, {%{name: "China", population: 1_374_000_000}})
138-
iex> :ets.insert(table, {%{name: "India", population: 1_284_000_000}})
139-
iex> :ets.insert(table, {%{name: "USA", population: 322_000_000}})
140+
# Store as tuples with {name, population}
141+
iex> :ets.insert(table, {"China", 1_374_000_000})
142+
iex> :ets.insert(table, {"India", 1_284_000_000})
143+
iex> :ets.insert(table, {"USA", 322_000_000})
140144
iex> :ets.i(table)
141-
<1 > {#{name => <<"USA">>,population => 322000000}}
142-
<2 > {#{name => <<"China">>,population => 1374000000}}
143-
<3 > {#{name => <<"India">>,population => 1284000000}}
145+
<1 > {"USA", 322000000}
146+
<2 > {"China", 1_374_000_000}
147+
<3 > {"India", 1_284_000_000}
144148
```
145149

146150
## The math module
@@ -168,15 +172,15 @@ that implements (double-ended) FIFO (first-in first-out) queues efficiently:
168172
iex> q = :queue.new
169173
iex> q = :queue.in("A", q)
170174
iex> q = :queue.in("B", q)
171-
iex> q = :queue.in("C", q)
172-
iex> {_, q} = :queue.out(q)
173-
{{:value, "A"}, {["C"], ["B"]}}
174-
iex> {_, q} = :queue.out(q)
175-
{{:value, "B"}, {[], ["C"]}}
176-
iex> {_, q} = :queue.out(q)
177-
{{:value, "C"}, {[], []}}
178-
iex> {_, q} = :queue.out(q)
179-
{:empty, {[], []}}
175+
iex> {value, q} = :queue.out(q)
176+
iex> value
177+
{:value, "A"}
178+
iex> {value, q} = :queue.out(q)
179+
iex> value
180+
{:value, "B"}
181+
iex> {value, q} = :queue.out(q)
182+
iex> value
183+
:empty
180184
```
181185

182186
## The rand module

0 commit comments

Comments
 (0)