Created
September 22, 2012 18:00
-
-
Save hcarty/3767210 to your computer and use it in GitHub Desktop.
Convenience versions of BatBounded functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let saturate_of_ord ~(bounds : 'a bound_t * 'a bound_t) ord = | |
match bounds with | |
| `o l, `o h | |
| `c l, `c h | |
| `o l, `c h | |
| `c l, `o h -> | |
bounding_of_ord ~default_low:l ~default_high:h ord ~bounds | |
|- BatOption.get | |
| `u, `o h | |
| `u, `c h -> | |
bounding_of_ord ~default_high:h ord ~bounds | |
|- BatOption.get | |
| `o l, `u | |
| `c l, `u -> | |
bounding_of_ord ~default_low:l ord ~bounds | |
|- BatOption.get | |
| `u, `u -> | |
bounding_of_ord ord ~bounds | |
|- BatOption.get | |
let opt_of_ord ~(bounds : 'a bound_t * 'a bound_t) ord = | |
bounding_of_ord ord ~bounds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment