[MLton-commit] r6768
Matthew Fluet
fluet at mlton.org
Tue Aug 19 15:16:34 PDT 2008
Use unsafe array updates and additions.
----------------------------------------------------------------------
U mlton/trunk/basis-library/util/CUtil.sml
----------------------------------------------------------------------
Modified: mlton/trunk/basis-library/util/CUtil.sml
===================================================================
--- mlton/trunk/basis-library/util/CUtil.sml 2008-08-19 22:16:22 UTC (rev 6767)
+++ mlton/trunk/basis-library/util/CUtil.sml 2008-08-19 22:16:31 UTC (rev 6768)
@@ -29,8 +29,8 @@
fun loop i =
if i >= n
then ()
- else (Array.update (a, i, sub (s, i))
- ; loop (i + 1))
+ else (Array.unsafeUpdate (a, i, sub (s, i))
+ ; loop (i +? 1))
val () = loop 0
in
a
@@ -97,12 +97,14 @@
*)
fun fromList l =
let
- val a = Array.array (1 +? List.length l, NullString.empty)
+ val n = List.length l
+ val a = Array.arrayUninit (1 +? n)
val _ =
List.foldl (fn (s, i) =>
- (Array.update (a, i, NullString.nullTerm s)
+ (Array.unsafeUpdate (a, i, NullString.nullTerm s)
; i +? 1))
0 l
+ val _ = Array.unsafeUpdate (a, n, NullString.empty)
in
a
end
More information about the MLton-commit
mailing list