mirror of
https://github.com/rjNemo/functional-programming-jargon
synced 2026-06-11 13:06:42 +00:00
Fixed errors and inconsistencies with point-free
This commit is contained in:
parent
0a9c2169ef
commit
ee69aed809
1 changed files with 3 additions and 3 deletions
|
|
@ -133,13 +133,13 @@ let add = (a, b) => a + b;
|
||||||
// Not points-free - `numbers` is an explicit parameter
|
// Not points-free - `numbers` is an explicit parameter
|
||||||
let incrementAll = (numbers) => map(add(1))(numbers);
|
let incrementAll = (numbers) => map(add(1))(numbers);
|
||||||
|
|
||||||
// Points-free - The array is an implicit parameter
|
// Points-free - The list is an implicit parameter
|
||||||
let incrementAll2 = map(add(1));
|
let incrementAll2 = map(add(1));
|
||||||
```
|
```
|
||||||
|
|
||||||
`total1` lists and uses the parameter `numbers`, so it is not points-free. `total2` is written just by combining functions and values, making no mention of its arguments. It __is__ points-free.
|
`incrementAll` identifies and uses the parameter `numbers`, so it is not points-free. `incrementAll2` is written just by combining functions and values, making no mention of its arguments. It __is__ points-free.
|
||||||
|
|
||||||
It is easy to recognize points-free function definitions; they are the ones that contain no '`function`' keywords and no fat arrows.
|
Points-free function definitions look just like normal assignments without `function` or `=>`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue