[MLton-commit] r5761
Vesa Karvonen
vesak at mlton.org
Wed Jul 11 08:56:58 PDT 2007
Avoid overflow check.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/basic.sml
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/basic.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/basic.sml 2007-07-11 15:05:16 UTC (rev 5760)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/basic.sml 2007-07-11 15:56:57 UTC (rev 5761)
@@ -11,6 +11,11 @@
fun failing m _ = fail m
fun raising e _ = raise e
fun recur x = Fn.flip Fn.fix x
- fun repeat f n x = if n = 0 then x else repeat f (n-1) (f x)
+ fun repeat f n x =
+ if n < 0
+ then raise Domain
+ else recur (Word.fromInt n, x) (fn lp =>
+ fn (0w0, x) => x
+ | (n, x) => lp (n-0w1, f x))
fun undefined _ = fail "undefined"
end
More information about the MLton-commit
mailing list