diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-07-13 20:07:10 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-07-13 20:07:10 -0400 |
commit | 811a3831805bf7a87ed3a64156f4ac6f6246edb9 (patch) | |
tree | a2bc2022ac4e0412a787a526135aafc99db66998 /src/list_util.sml | |
parent | 97cc749872a8baf53bb34ef1b536b82f6aa7f1c7 (diff) |
Passing an argument to a web function
Diffstat (limited to 'src/list_util.sml')
-rw-r--r-- | src/list_util.sml | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/list_util.sml b/src/list_util.sml index fff3e78e..976e4708 100644 --- a/src/list_util.sml +++ b/src/list_util.sml @@ -136,4 +136,14 @@ fun search f = 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 |