Skip to content

Commit 72779b0

Browse files
committed
Update to latest content
1 parent d8c50a7 commit 72779b0

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

Map & Filter/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Map 和 Filter
1+
# Map,FilterReduce
22

3-
Map 和 Filter这两个函数能为函数式编程提供便利。我们会通过实例一个一个讨论并理解它们。
3+
Map,FilterReduce 三个函数能为函数式编程提供便利。我们会通过实例一个一个讨论并理解它们。

Map & Filter/Reduce.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# ```Reduce```
2+
3+
当需要对一个列表进行一些计算并返回结果时,`Reduce` 是个非常有用的函数。举个例子,当你需要计算一个整数列表的乘积时。
4+
5+
通常在 python 中你可能会使用基本的 for 循环来完成这个任务。
6+
7+
现在我们来试试 reduce:
8+
9+
```
10+
from functools import reduce
11+
product = reduce( (lambda x, y: x * y), [1, 2, 3, 4] )
12+
13+
# Output: 24
14+
```

SUMMARY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
* [迭代器(Iterator)](Generators/Iterator.md)
1616
* [迭代(Iteration)](Generators/Iteration.md)
1717
* [生成器(Generators)](Generators/Generators.md)
18-
* [Map和Filter](Map & Filter/README.md)
18+
* [Map,Filter 和 Reduce](Map & Filter/README.md)
1919
* [Map](Map & Filter/Map.md)
2020
* [Filter](Map & Filter/Filter.md)
21+
* [Reduce](Map & Filter/Reduce.md)
2122
* [set 数据结构](set_data_structure/set_data_structure.md)
2223
* [三元运算符](ternary_operators/ternary_operators.md)
2324
* [装饰器](decorators/README.md)

0 commit comments

Comments
 (0)