allfn
Summary
Returns a function that returns true if all predicates have passed when applied to its arguments.
Description
Takes one or more predicates and returns a function
that takes any number of arguments and returns true
if each predicate has returned logical true when applied
to these arguments.
Examples
Make sure that both x
and y
are numbers and produce the correct answer when added up.
1 2 3 4 5 6 7 8 9 |
|
-
1st predicate: checks both arguments are numbers.
-
2nd predicate: checks numbers add up to 42.
-
passed: both arguments are numbers and add up to 42.
-
failed: both arguments are numbers but do not add up to 42.
-
failed: 1st argument is not a number.
Parameters
Name | Type | Description |
---|---|---|
fn | function |
One or more predicates |
Return
function