From baf22271ef6e646c97ddfa1e4193a8857816c67d Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Fri, 8 Aug 2008 10:28:32 -0400 Subject: Parametrized datatypes through explify --- src/list_util.sml | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/list_util.sml') diff --git a/src/list_util.sml b/src/list_util.sml index 976e4708..616efcf0 100644 --- a/src/list_util.sml +++ b/src/list_util.sml @@ -146,4 +146,14 @@ fun mapi f = m 0 [] end +fun foldli f = + let + fun m i acc ls = + case ls of + [] => acc + | h :: t => m (i + 1) (f (i, h, acc)) t + in + m 0 + end + end -- cgit v1.2.3