diff src/list_util.sml @ 120:6230bdd122e7

Passing an argument to a web function
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Jul 2008 20:07:10 -0400
parents 3739af9e727a
children aa54250f58ac
line wrap: on
line diff
--- a/src/list_util.sml	Sun Jul 13 16:11:25 2008 -0400
+++ b/src/list_util.sml	Sun Jul 13 20:07:10 2008 -0400
@@ -136,4 +136,14 @@
         s
     end
 
+fun mapi f =
+    let
+        fun m i acc ls =
+            case ls of
+                [] => rev acc
+              | h :: t => m (i + 1) (f (i, h) :: acc) t
+    in
+        m 0 []
+    end
+
 end