Skip to content

Commit 6aa0e89

Browse files
committed
Improved readability of HOF transition
Improved the readability of the transition from two simple functions to HOF functions.
1 parent 36500a0 commit 6aa0e89

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

functions/higher_order.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ map(add_2, [5,6,7]) // => [7, 8, 9]
3333
map(double, [5,6,7]) // => [10, 12, 14]
3434
```
3535

36-
The functions in the above example were intentionally simple,
37-
and serves to illustrate that passing functions as arguments
38-
to other functions allows for flexibility when building things.
36+
The functions in the above example are simple. However, when passed as arguments to other functions, they can be composed in unforeseen ways to build more complex functions.
3937

40-
For example, if we notice that we use the invocations `map(add_2, ...)` and `map(double, ...)` very often in our code, we could decide we want to create two special-purpse list processors that have the desired operation baked into them. Using function composition, we could do this as follows:
38+
For example, if we notice that we use the invocations `map(add_2, ...)` and `map(double, ...)` very often in our code, we could decide we want to create two special-purpse list processing functions that have the desired operation baked into them. Using function composition, we could do this as follows:
4139

4240
```javascript
4341
process_add_2 = function(list) {

0 commit comments

Comments
 (0)