aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/chapter1_functions/lesson04_anonymous_functions/text.html6
-rw-r--r--src/content/chapter2_flow_control/lesson01_case_expressions/text.html17
-rw-r--r--src/content/chapter2_flow_control/lesson02_variable_patterns/text.html17
-rw-r--r--src/content/chapter2_flow_control/lesson03_string_patterns/text.html4
-rw-r--r--src/content/chapter2_flow_control/lesson09_alternative_patterns/text.html5
-rw-r--r--src/content/chapter3_data_types/lesson01_custom_types/text.html4
-rw-r--r--src/content/chapter3_data_types/lesson05_nil/text.html4
-rw-r--r--src/content/chapter3_data_types/lesson06_results/text.html2
-rw-r--r--src/content/chapter5_advanced_features/lesson03_panic/text.html6
-rw-r--r--src/content/chapter5_advanced_features/lesson04_externals/text.html2
-rw-r--r--src/content/chapter5_advanced_features/lesson05_multi_target_externals/text.html2
11 files changed, 31 insertions, 38 deletions
diff --git a/src/content/chapter1_functions/lesson04_anonymous_functions/text.html b/src/content/chapter1_functions/lesson04_anonymous_functions/text.html
index f7bea3f..6c6d47d 100644
--- a/src/content/chapter1_functions/lesson04_anonymous_functions/text.html
+++ b/src/content/chapter1_functions/lesson04_anonymous_functions/text.html
@@ -1,7 +1,5 @@
<p>
As well as module-level named functions, Gleam has anonymous function
- literals.
-</p>
-<p>
- Anonymous functions can be used interchangeably with named functions.
+ literals, written with the <code>fn() { ... }</code> syntax.
</p>
+<p>Anonymous functions can be used interchangeably with named functions.</p>
diff --git a/src/content/chapter2_flow_control/lesson01_case_expressions/text.html b/src/content/chapter2_flow_control/lesson01_case_expressions/text.html
index 7e9ac11..b3e4000 100644
--- a/src/content/chapter2_flow_control/lesson01_case_expressions/text.html
+++ b/src/content/chapter2_flow_control/lesson01_case_expressions/text.html
@@ -1,7 +1,18 @@
<p>
- Patterns in case expressions can also assign variables.
+ The case expression is the most common kind of flow control in Gleam code. It
+ is similar to <code>switch</code> in some other languages, but more powerful
+ than most.
</p>
<p>
- When a variable name is used in a pattern the value that is matched against is
- assigned to that name, and can be used in the body of that clause.
+ It allows the programmer to say "if the data has this shape then run this
+ code", a process called called <em>pattern matching</em>.
+</p>
+<p>
+ Gleam performs <em>exhaustiveness checking</em> to ensure that the patterns in
+ a case expression cover all possible values. With this you can have confidence
+ that your logic is up-to-date for the design of the data you are working with.
+</p>
+<p>
+ Try commenting out patterns or adding new redundant ones, and see what
+ problems the compiler reports.
</p>
diff --git a/src/content/chapter2_flow_control/lesson02_variable_patterns/text.html b/src/content/chapter2_flow_control/lesson02_variable_patterns/text.html
index b3e4000..7e9ac11 100644
--- a/src/content/chapter2_flow_control/lesson02_variable_patterns/text.html
+++ b/src/content/chapter2_flow_control/lesson02_variable_patterns/text.html
@@ -1,18 +1,7 @@
<p>
- The case expression is the most common kind of flow control in Gleam code. It
- is similar to <code>switch</code> in some other languages, but more powerful
- than most.
+ Patterns in case expressions can also assign variables.
</p>
<p>
- It allows the programmer to say "if the data has this shape then run this
- code", a process called called <em>pattern matching</em>.
-</p>
-<p>
- Gleam performs <em>exhaustiveness checking</em> to ensure that the patterns in
- a case expression cover all possible values. With this you can have confidence
- that your logic is up-to-date for the design of the data you are working with.
-</p>
-<p>
- Try commenting out patterns or adding new redundant ones, and see what
- problems the compiler reports.
+ When a variable name is used in a pattern the value that is matched against is
+ assigned to that name, and can be used in the body of that clause.
</p>
diff --git a/src/content/chapter2_flow_control/lesson03_string_patterns/text.html b/src/content/chapter2_flow_control/lesson03_string_patterns/text.html
index 0dd3274..11e4c35 100644
--- a/src/content/chapter2_flow_control/lesson03_string_patterns/text.html
+++ b/src/content/chapter2_flow_control/lesson03_string_patterns/text.html
@@ -1,9 +1,9 @@
<p>
When pattern matching on strings the <code>&lt;&gt;</code> operator can be
used to match on strings with a specific prefix.
-</p>
+</p>
<p>
The pattern <code>"hello " <> name</code> matches any string that starts with
- <code>"hello "</code> and asigns the rest of the string to the variable
+ <code>"hello "</code> and assigns the rest of the string to the variable
<code>name</code>.
</p>
diff --git a/src/content/chapter2_flow_control/lesson09_alternative_patterns/text.html b/src/content/chapter2_flow_control/lesson09_alternative_patterns/text.html
index 10ad731..25421f4 100644
--- a/src/content/chapter2_flow_control/lesson09_alternative_patterns/text.html
+++ b/src/content/chapter2_flow_control/lesson09_alternative_patterns/text.html
@@ -3,11 +3,6 @@
<code>|</code> operator. If any of the patterns match then the clause matches.
</p>
<p>
- When matching on multiple subjects there must be the same number of patterns
- as there are subjects. Try removing one of the <code>_,</code> sub-patterns to
- see the compile time error that is returned.
-</p>
-<p>
If a pattern defines a variable then all of the alternative patterns for that
clause must also define a variable with the same name and same type.
</p>
diff --git a/src/content/chapter3_data_types/lesson01_custom_types/text.html b/src/content/chapter3_data_types/lesson01_custom_types/text.html
index dad6d12..3a95f9f 100644
--- a/src/content/chapter3_data_types/lesson01_custom_types/text.html
+++ b/src/content/chapter3_data_types/lesson01_custom_types/text.html
@@ -3,7 +3,7 @@
but custom types allow the creation of entirely new types.
</p>
<p>
- A custom type is defined with the <code>type</code> keyword followed by a
- constructor for each <em>variant</em> of the type.
+ A custom type is defined with the <code>type</code> keyword followed by the
+ name of the type and a constructor for each <em>variant</em> of the type.
</p>
<p>Custom type variants can be pattern matched on using a case expression.</p>
diff --git a/src/content/chapter3_data_types/lesson05_nil/text.html b/src/content/chapter3_data_types/lesson05_nil/text.html
index 3416643..723312b 100644
--- a/src/content/chapter3_data_types/lesson05_nil/text.html
+++ b/src/content/chapter3_data_types/lesson05_nil/text.html
@@ -1,12 +1,12 @@
<p>
<code>Nil</code> is Gleam's unit type. It is a value that is returned by
- functions that have nothing else to return, as all functions much return
+ functions that have nothing else to return, as all functions must return
something.
</p>
<p>
<code>Nil</code> is not a valid value of any other types, that is values in
Gleam are not nullable. If the type of a value is <code>Nil</code> then it is
- the value <code>nil</code>. If it is some other type then the value is not
+ the value <code>Nil</code>. If it is some other type then the value is not
<code>Nil</code>.
</p>
<p>
diff --git a/src/content/chapter3_data_types/lesson06_results/text.html b/src/content/chapter3_data_types/lesson06_results/text.html
index fe0f7ba..2e1b16b 100644
--- a/src/content/chapter3_data_types/lesson06_results/text.html
+++ b/src/content/chapter3_data_types/lesson06_results/text.html
@@ -28,7 +28,7 @@
No nasty surprises with unexpected exceptions!
</p>
<p>
- Result value can be handled by pattern matching with a
+ A result value can be handled by pattern matching with a
<code>case</code> expression, but given how frequently results are returned
this can become unwieldy. Gleam code commonly uses the
<code>gleam/result</code> standard library module and
diff --git a/src/content/chapter5_advanced_features/lesson03_panic/text.html b/src/content/chapter5_advanced_features/lesson03_panic/text.html
index 843a65b..c54c217 100644
--- a/src/content/chapter5_advanced_features/lesson03_panic/text.html
+++ b/src/content/chapter5_advanced_features/lesson03_panic/text.html
@@ -1,7 +1,7 @@
<p>
- The <code>panic</code> keyword is similar to <code>todo</code> keyword, but it
- is used to crash the program when the program has reached a point that should
- never be reached.
+ The <code>panic</code> keyword is similar to the <code>todo</code> keyword,
+ but it is used to crash the program when the program has reached a point that
+ should never be reached.
</p>
<p>
This keyword should almost never be used! It may be useful in initial
diff --git a/src/content/chapter5_advanced_features/lesson04_externals/text.html b/src/content/chapter5_advanced_features/lesson04_externals/text.html
index 81202d6..8815fa7 100644
--- a/src/content/chapter5_advanced_features/lesson04_externals/text.html
+++ b/src/content/chapter5_advanced_features/lesson04_externals/text.html
@@ -5,7 +5,7 @@
import and use this non-Gleam code.
</p>
<p>
- An external type is a one that has no constructors. Gleam doesn't know what
+ An external type is one that has no constructors. Gleam doesn't know what
shape it has or how to create one, it only knows that it exists.
</p>
<p>
diff --git a/src/content/chapter5_advanced_features/lesson05_multi_target_externals/text.html b/src/content/chapter5_advanced_features/lesson05_multi_target_externals/text.html
index dc10a19..6e02d36 100644
--- a/src/content/chapter5_advanced_features/lesson05_multi_target_externals/text.html
+++ b/src/content/chapter5_advanced_features/lesson05_multi_target_externals/text.html
@@ -7,7 +7,7 @@
target then the compiler will return an error.
</p>
<p>
- You should try to implement functons for all targets, but this isn't always
+ You should try to implement functions for all targets, but this isn't always
possible due to incompatibilities in how IO and concurreny works in Erlang and
JavaScript. With Erlang concurrent IO is handled transparently by the runtime,
while in JavaScript concurrent IO requires the use of promises or callbacks.