Skip to content

Commit a892677

Browse files
committed
Updated docs. [skip CI]
1 parent b216216 commit a892677

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

doc/docs/doc/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ inventory =
7474
* name: "bread"
7575
count: 3
7676

77+
-- list comprehension
78+
map = (arr, action) ->
79+
[action item for item in *arr]
80+
81+
filter = (arr, cond) ->
82+
[item for item in *arr when cond item]
83+
84+
reduce = (arr, init, action): init ->
85+
init = action init, item for item in *arr
86+
7787
-- pipe operator
7888
[1, 2, 3]
7989
|> map (x) -> x * 2

doc/docs/zh/doc/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ inventory =
7474
* name: "bread"
7575
count: 3
7676

77+
-- 列表推导
78+
map = (arr, action) ->
79+
[action item for item in *arr]
80+
81+
filter = (arr, cond) ->
82+
[item for item in *arr when cond item]
83+
84+
reduce = (arr, init, action): init ->
85+
init = action init, item for item in *arr
86+
7787
-- 管道操作符
7888
[1, 2, 3]
7989
|> map (x) -> x * 2

0 commit comments

Comments
 (0)