lt<A> function
- Ord<
A> O
Returns a function that checks if the first argument is less than the second.
Example:
void main() {
// Create an Ord instance for integers
Ord<int> ordInt = fromCompare((x, y) => x.compareTo(y));
// Create a 'less than' function for integers using the ordInt instance
bool Function(int, int) isLessThan = lt(ordInt);
// Check if one integer is less than the other
bool result = isLessThan(5, 10); // Output: true (5 is less than 10)
}
Implementation
bool Function(A first, A second) lt<A>(Ord<A> O) {
return (A first, A second) => O.compare(first, second) < 0;
}