Added definition for predicate.

This commit is contained in:
jethro larson 2016-07-14 13:27:00 -07:00
parent 13de2a5df9
commit 67c71526de

View file

@ -17,6 +17,7 @@ Where applicable, this document uses terms defined in the [Fantasy Land spec](ht
* [Side effects](#side-effects)
* [Idempotent](#idempotent)
* [Point-Free Style](#point-free-style)
* [Predicate](#predicate)
* [Contracts](#contracts)
* [Guarded Functions](#guarded-functions)
* [Categories](#categories)
@ -197,7 +198,14 @@ let incrementAll2 = map(add(1));
Points-free function definitions look just like normal assignments without `function` or `=>`.
## Predicate
A predicate is a function that returns true or false for a given value. A common use of a predicate is as the callback for array filter.
```js
const predicate = (a) => a > 2;
[1, 2, 3, 4].filter(predicate); // [3, 4]
```
## Contracts