Refactor webbw
authorAdam Chlipala <adamc@hcoop.net>
Thu, 11 Aug 2005 03:19:53 +0000 (03:19 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Thu, 11 Aug 2005 03:19:53 +0000 (03:19 +0000)
src/apache/stats/webbw.cm
src/apache/stats/webbw.sml
src/domtool.cm
src/mlton_util.sig [deleted file]
src/mlton_util.sml [deleted file]
src/util.sig
src/util.sml

index 1467df7..4a906b1 100644 (file)
@@ -1,7 +1,10 @@
 Group is
+       ../../smlnj-lib/sources.cm
+       ../../map.sml
+
        ../../config.sml
-       ../../mlton_util.sig
-       ../../mlton_util.sml
+       ../../util.sig
+       ../../util.sml
 
        ../config.sml
 
index ce777b9..f1bd357 100644 (file)
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 open Config
 open ApacheConfig
-open MltonUtil
+open Util
 
 val groupsBase = wblDocDir ^ "/" ^ defaultHost ^ "/url_"
 (* Where to look for grouped user statistics *)
index 626c6de..ee6eee4 100644 (file)
@@ -1,13 +1,4 @@
 Group is
-       (*$/basis.cm*)
-
-       (*smlnj-lib/lib-base-sig.sml
-       smlnj-lib/lib-base.sml
-       smlnj-lib/ord-key-sig.sml
-       smlnj-lib/ord-map-sig.sml
-       smlnj-lib/binary-map-fn.sml
-       smlnj-lib/ord-set-sig.sml
-       smlnj-lib/binary-set-fn.sml*)
        smlnj-lib/sources.cm
 
        config.sml
diff --git a/src/mlton_util.sig b/src/mlton_util.sig
deleted file mode 100644 (file)
index 0604b75..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-(*
-Domtool (http://hcoop.sf.net/)
-Copyright (C) 2004-2005  Adam Chlipala
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-*)
-
-(* Utility functions for MLton programs *)
-
-signature MLTON_UTIL =
-sig
-    val mergeSort : ('a * int) list -> ('a * int) list
-    (* Sort the argument list in descending integer order. *)
-end
diff --git a/src/mlton_util.sml b/src/mlton_util.sml
deleted file mode 100644 (file)
index 89577bc..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-(*
-Domtool (http://hcoop.sf.net/)
-Copyright (C) 2004-2005  Adam Chlipala
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-*)
-
-(* Utility functions *)
-
-structure MltonUtil :> MLTON_UTIL =
-struct
-    fun merge (L1 : ('a * int) list, L2 : ('a * int) list) acc =
-       case (L1, L2) of
-           (_, []) => List.revAppend (acc, L1)
-         | ([], _) => List.revAppend (acc, L2)
-         | (n1::t1, n2::t2) =>
-           if #2 n1 > #2 n2 then
-               merge (t1, L2) (n1 :: acc)
-           else
-               merge (L1, t2) (n2 :: acc)
-
-    fun split n L acc =
-       if n <= 0 then
-           (acc, L)
-       else
-           case L of
-               [] => (acc, [])
-             | h::t => split (n-1) t (h::acc)
-
-    fun mergeSort L =
-       case L of
-           [] => L
-         | [a] => L
-         | _ =>
-           let
-               val mid = length L div 2
-               val (L1, L2) = split mid L []
-           in
-               merge (mergeSort L1, mergeSort L2) []
-           end
-end
-
index 445ae43..635ef67 100644 (file)
@@ -79,4 +79,7 @@ sig
     val enrichSetFromFile : string * StringSet.set -> StringSet.set
     (* Add the entries in the file to the set.
      * A "CLEAR" entry clears the set. *)
+
+    val mergeSort : ('a * int) list -> ('a * int) list
+    (* Sort the argument list in descending integer order. *)
 end
index 093a4f2..dc95dc2 100644 (file)
@@ -162,5 +162,35 @@ struct
            else
                set
        end
+
+    fun merge (L1 : ('a * int) list, L2 : ('a * int) list) acc =
+       case (L1, L2) of
+           (_, []) => List.revAppend (acc, L1)
+         | ([], _) => List.revAppend (acc, L2)
+         | (n1::t1, n2::t2) =>
+           if #2 n1 > #2 n2 then
+               merge (t1, L2) (n1 :: acc)
+           else
+               merge (L1, t2) (n2 :: acc)
+
+    fun split n L acc =
+       if n <= 0 then
+           (acc, L)
+       else
+           case L of
+               [] => (acc, [])
+             | h::t => split (n-1) t (h::acc)
+
+    fun mergeSort L =
+       case L of
+           [] => L
+         | [a] => L
+         | _ =>
+           let
+               val mid = length L div 2
+               val (L1, L2) = split mid L []
+           in
+               merge (mergeSort L1, mergeSort L2) []
+           end
 end