Interval.Make(map f (a,b)) is (f a, f b): applies the same function to each element of the pair.
(between (lo,hi) n) is true iff n is contained in the open interval (lo,hi).
(between (lo,hi) n) = (lo < n && n < hi)(contains (lo,hi) n) is true iff n is contained in the closed interval [lo,hi].
(contains (lo,hi) n) = (lo <= n && n <= hi)foldil f i (a,z): folds f left-associatively across the closed interval [a,z] (tail-recursive).
i is the initial accumulator value.
Examples:
(foldil ( * ) 1 (1,6)) = ((((((1*1)*2)*3)*4)*5)*6) = 720foldir f i (a,z): folds f right-associatively across the closed interval [a,z] (not tail-recursive)
i is the initial accumulator value.
Examples:
(foldir ( + ) 0 (1,6)) = (0+(1+(2+(3+(4+(5+6)))))) = 21(foldir cons [] (1,6)) = [1; 2; 3; 4; 5; 6]foreach f (a,z): iterates f for side-effect across the closed interval [a,z] (tail-recursive)
(let r = ref 1 in foreach (( *:= ) r) (1,6); !r) = 720 val to_string :
?left:string ->
?sep:string ->
?right:string ->
('a -> string) ->
('a * 'a) ->
string(to_string ?left ?sep ?right f (a,z)) returns a string representation of the interval (a,z).
The optional parameters are interpreted as for Pair.to_string.
(print ?left ?sep ?right f) is (to_string ?left ?sep ?right f >> print_endline).