Glossary
Info
List of terms and concepts used throughout the library.
functional placeholder
A special value used in curried functions that will be substituted with the real value later on. Useful with operator functions.
logical truth
Any value that is neither false
nor nil constitutes logical truth.
Please note that 0
, ''
and NaN
also constitute logical truth.
logical falsity
Any value that is either false
or nil constitutes logical falsity.
nil
Either null
or undefined
.
operator function
An operator function is a binary function with left and right sections.
To illustrate this concept we will use the operator function subtract
which is the functional equivalent of a - b
.
When called with one argument the operator function assumes it has been given the right section and returns a function that takes the left section:
const sub2 = subtract(2);
sub2(44);
//=> 42
When called with two arguments and the second argument is the functional placeholder, the operator function assumes it has been given the left section and returns a function that takes the right section.
const subFrom44 = subtract(44, __);
subFrom44(2);
//=> 42
Operator functions in this library have been inspired by this answer from Stack Overflow.
predicate
A predicate is a function that uses logical truth or logical falsity to make a decision.