diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-06-19 12:39:22 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-06-19 12:39:22 -0400 |
commit | 8e98be7de2dd3db541994aae47aeb45756f60098 (patch) | |
tree | bbc63e96871ef6513d974d96311deab9afd4e7a3 /src/list_util.sml | |
parent | 371b414262cfb5888759c786e21c66f883ad13c0 (diff) |
Corify removes modules
Diffstat (limited to 'src/list_util.sml')
-rw-r--r-- | src/list_util.sml | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/list_util.sml b/src/list_util.sml index e3d8515e..7f87b87e 100644 --- a/src/list_util.sml +++ b/src/list_util.sml @@ -80,6 +80,39 @@ fun foldlMap f s = fm ([], s) end +fun foldlMapConcat f s = + let + fun fm (ls', s) ls = + case ls of + nil => (rev ls', s) + | h :: t => + let + val (h', s') = f (h, s) + in + fm (List.revAppend (h', ls'), s') t + end + in + fm ([], s) + end + +fun foldlMapPartial f s = + let + fun fm (ls', s) ls = + case ls of + nil => (rev ls', s) + | h :: t => + let + val (h', s') = f (h, s) + val ls' = case h' of + NONE => ls' + | SOME h' => h' :: ls' + in + fm (ls', s') t + end + in + fm ([], s) + end + fun search f = let fun s ls = |