@@ -74,7 +74,7 @@ of the list:
74
74
let squares = List.map (fun x -> x * x) [1; 2; 3]
75
75
```
76
76
77
- The ` List.filter : ('a -> bool) -> 'a list -> 'a list ` function should also look familar since it's implemented by many languages:
77
+ The ` List.filter : ('a -> bool) -> 'a list -> 'a list ` function should also look familiar since it's implemented by many languages:
78
78
79
79
``` ocaml
80
80
let evens = List.filter (fun x -> x mod 2 = 0) [1; 2; 3; 4] (* evens = [2; 4] *)
@@ -128,7 +128,7 @@ let () =
128
128
129
129
## Defining the list type
130
130
131
- Many data structures, including linked lists, can be defined _ inductively .
131
+ Many data structures, including linked lists, can be defined _ inductively _ .
132
132
133
133
An _ inductive definition_ consists of two parts: a _ base case_ that defines the least possible element,
134
134
and an _ inductive step_ that defines how to make larger structures from it.
@@ -215,7 +215,7 @@ The generalization of mathematical induction for data structures is known as _st
215
215
216
216
Every inductive definition of a function can be naturally converted to a recursive algorithm, assuming we know how to destructure
217
217
a value into its parts. For the factorial function, we had to substitute destructuring a natural number _ n_ into
218
- _ m + 1_ with substracting one from it.
218
+ _ m + 1_ with subtracting one from it.
219
219
220
220
Data structures defined as sum types can be directly destructured using pattern matching, which makes them easy to use with recursive functions.
221
221
0 commit comments