Skip to content

Commit

Permalink
Merge pull request #21 from delta4d/patch-1
Browse files Browse the repository at this point in the history
Fix typo (zipWidth => zipWith)
  • Loading branch information
flaneur2020 committed Oct 17, 2013
2 parents 3d50ebb + 59c1af3 commit 3c9dc93
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/_posts/07-module.txt
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ ghci> findIndices (`elem` ['A'..'Z']) "Where Are The Caps?"
[0,6,10,14]
}}

在前面,我們講過了 ``zip`` 和 ``zipWidth``,它們只能將兩個 List 組到一個二元組數或二參函數中,但若要組三個 List 該怎麼辦? 好說~ 有 ``zip3``,``zip4``,,,,和 ``zipWith3``, ``zipWidth4``...直到 7。這看起來像是個 hack,但工作良好。連着組 8 個 List 的情況很少遇到。還有個聰明辦法可以組起無限多個 List,但限於我們目前的水平,就先不談了.
在前面,我們講過了 ``zip`` 和 ``zipWith``,它們只能將兩個 List 組到一個二元組數或二參函數中,但若要組三個 List 該怎麼辦? 好說~ 有 ``zip3``,``zip4``,,,,和 ``zipWith3``, ``zipWith4``...直到 7。這看起來像是個 hack,但工作良好。連着組 8 個 List 的情況很少遇到。還有個聰明辦法可以組起無限多個 List,但限於我們目前的水平,就先不談了.

{{
ghci> zipWith3 (\x y z -> x + y + z) [1,2,3] [4,5,2,2] [2,2,3]
Expand Down

0 comments on commit 3c9dc93

Please sign in to comment.