GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Improved readability of HOF transition · atik2002/javascript@6aa0e89

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • functions
    • higher_order.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎functions/higher_order.md‎

Copy file name to clipboardExpand all lines: functions/higher_order.md
+2-4Lines changed: 2 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
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 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.