@@ -12,28 +12,6 @@ cart = [
12
12
13
13
Some examples use the [`string =~ part`](`=~/2`) operator, which checks the string on the left contains the part on the right.
14
14
15
- ## Filtering
16
- {: .col-2}
17
-
18
- ### [filter(enum, fun)](`Enum.filter/2`)
19
-
20
- ```elixir
21
- iex> Enum.filter(cart, &(&1.fruit =~ "o"))
22
- [
23
- %{fruit: "orange", count: 6}
24
- ]
25
- ```
26
-
27
- ### [reject(enum, fun)](`Enum.reject/2`)
28
-
29
- ```elixir
30
- iex> Enum.reject(cart, &(&1.fruit =~ "o"))
31
- [
32
- %{fruit: "apple", count: 3},
33
- %{fruit: "banana", count: 1}
34
- ]
35
- ```
36
-
37
15
## Predicates
38
16
{: .col-2}
39
17
@@ -96,6 +74,31 @@ iex> Enum.empty?([])
96
74
true
97
75
```
98
76
77
+ ## Filtering
78
+ {: .col-2}
79
+
80
+ ### [filter(enum, fun)](`Enum.filter/2`)
81
+
82
+ ```elixir
83
+ iex> Enum.filter(cart, &(&1.fruit =~ "o"))
84
+ [%{fruit: "orange", count: 6}]
85
+ iex> Enum.filter(cart, &(&1.fruit =~ "e"))
86
+ [
87
+ %{fruit: "apple", count: 3},
88
+ %{fruit: "orange", count: 6}
89
+ ]
90
+ ```
91
+
92
+ ### [reject(enum, fun)](`Enum.reject/2`)
93
+
94
+ ```elixir
95
+ iex> Enum.reject(cart, &(&1.fruit =~ "o"))
96
+ [
97
+ %{fruit: "apple", count: 3},
98
+ %{fruit: "banana", count: 1}
99
+ ]
100
+ ```
101
+
99
102
## Mapping
100
103
{: .col-2}
101
104
0 commit comments