[MLton-commit] r5870

Vesa Karvonen vesak at mlton.org
Tue Aug 14 01:08:24 PDT 2007


Added inRange to ORDERED.

----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/concept/mk-ordered.fun
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/ordered.sig

----------------------------------------------------------------------

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/concept/mk-ordered.fun
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/concept/mk-ordered.fun	2007-08-14 06:46:33 UTC (rev 5869)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/concept/mk-ordered.fun	2007-08-14 08:08:23 UTC (rev 5870)
@@ -12,4 +12,6 @@
    val {<, <=, >, >=, ==, !=} = Cmp.mkRelOps compare
    val max = Cmp.max compare
    val min = Cmp.min compare
+   fun inRange (lo, hi) =
+       if hi < lo then raise Domain else fn v => lo <= v andalso v <= hi
 end

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/ordered.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/ordered.sig	2007-08-14 06:46:33 UTC (rev 5869)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/concept/ordered.sig	2007-08-14 08:08:23 UTC (rev 5870)
@@ -41,6 +41,12 @@
 
    val min : ordered_ex BinOp.t
    (** Returns the smaller of the arguments. *)
+
+   val inRange : ordered_ex Sq.t -> ordered_ex UnPr.t
+   (**
+    * {inRange (lo, hi) v} is equivalent to {lo <= v andalso v <= hi},
+    * except that {inRange (lo, hi)} raises {Domain} iff {hi < lo}.
+    *)
 end
 
 signature ORDERED = sig




More information about the MLton-commit mailing list